PL/SQL parser (MDEV-10142)

[MDEV-11952] Oracle-style packages: Phase#1: Translate packages to databases Created: 2017-01-31  Updated: 2018-08-31  Resolved: 2018-02-14

Status: Closed
Project: MariaDB Server
Component/s: Parser, Stored routines
Affects Version/s: 10.3
Fix Version/s: N/A

Type: Technical task Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Won't Fix Votes: 1
Labels: Compatibility

Issue Links:
Blocks
blocks MDEV-10591 Oracle-style packages Closed
Sprint: 10.2.2-3, 10.2.2-1, 10.2.2-2, 10.2.2-4, 10.1.18

 Description   

Under terms of this task we'll implement a subset of PACKAGE related functionality described in MDEV-10591.

The full grammar looks like:

CREATE [ OR REPLACE ] PACKAGE [schema .] package [invoker_rights_clause] {IS|AS} plsql_package_spec ;
CREATE [ OR REPLACE ] PACKAGE BODY [schema .] package {IS|AS} plsql_package_body ;
DROP PACKAGE [schema.] package;
DROP PACKAGE BODY [schema.] package;

Under terms of this task we'll implement:

CREATE PACKAGE package {IS|AS} plsql_package_spec ;
CREATE PACKAGE BODY package {IS|AS} plsql_package_body ;
DROP PACKAGE [IF EXISTS] package;
DROP PACKAGE BODY [IF EXISTS] package;

Instead of storing package definitions in a new system table, packages will be translated to databases. So for example, CREATE PACKAGE p1 will actually create a new database p1, and all package routines will be translated to routines of the database p1.

Limitations and features of this task:

  • CREATE PACKAGE won't include the invoker_rights_clause
  • PACKAGE related statements won't have the optional schema name clause
  • plsql_package_spec and pgsql_package_body will understand only functions and procedures at this point (no other object types, such as exceptions, package wide variables, etc)
  • CREATE PACKAGE will check routine specifications for correct syntax, but will just ignore them. If CREATE PACKAGE BODY does not match CREATE PACKAGE, no errors will happen.
  • Routines declared as internal (private) body routines will be publicly accessible.
  • Packages will reuse the same name space with schema (database) names. Packages will reside on the same level with schemas, not inside schemas. So two different users won't be able to create packages with the same names.
  • CREATE PACKAGE and CREATE PACKAGE BODY won't have the OR REPLACE clause
  • CREATE PACKAGE will have the optional IF NOT EXISTS clause
  • DROP PACKAGE will have an optional IF EXISTS clause


 Comments   
Comment by Alexander Barkov [ 2017-02-01 ]

Pushed to bb-10.2-compatibility

Comment by Alexander Barkov [ 2017-03-10 ]

Reviewed by Monty

Comment by Michael Widenius [ 2018-01-13 ]

Reopened for review

Comment by Sergei Golubchik [ 2018-02-14 ]

A different solution was implemented in MDEV-10591

Generated at Thu Feb 08 07:53:56 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.