Details

    Description

      Oracle knows an object type called Synonyms:
      https://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_7001.htm

      "Use the CREATE SYNONYM statement to create a synonym, which is an alternative name for a table, view, sequence, procedure, stored function, package, materialized view, Java class schema object, user-defined object type, or another synonym.

      Synonyms provide both data independence and location transparency. Synonyms permit applications to function without modification regardless of which user owns the table or view and regardless of which database holds the table or view. However, synonyms are not a substitute for privileges on database objects. Appropriate privileges must be granted to a user before the user can use the synonym."

      This is still lacking in MariaDB 10.3 oracle mode. IMHO this is crucial for oracle portability because it allows to have packages (e.g. dbms_output) only once per instance instead of once per schema (see also example here (at the very end): http://www.fromdual.com/select-hello-world-fromdual-with-mariadb-pl-sql

      Possibly, synonyms to these object types can go into a separate MDEV each:

      • table
      • view
      • sequence
      • procedure
      • stored function
      • package

      Attachments

        Issue Links

          Activity

            SQL> SELECT * FROM dba_objects WHERE object_name IN ('DUAL', 'DBMS_OUTPUT');

            OWNER OBJECT_NAME SUBOBJECT_NAME OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE CREATED LAST_DDL TIMESTAMP STATUS T G S NAMESPACE EDITION_NAME SHARING E O
            ------ ----------- -------------- ---------- -------------- ----------- -------- -------- ------------------- ------- - - - ---------- ----------- ------- - -
            SYS DUAL 142 142 TABLE 21.03.16 21.03.16 2016-03-21:11:57:46 VALID N N N 1 NONE Y
            PUBLIC DUAL 143 SYNONYM 21.03.16 21.03.16 2016-03-21:11:57:46 VALID N N N 1 NONE N Y
            SYS DBMS_OUTPUT 999 999 PACKAGE 21.03.16 21.03.16 2016-03-21:11:57:46 VALID N N N 1 NONE Y
            PUBLIC DBMS_OUTPUT 1000 SYNONYM 21.03.16 21.03.16 2016-03-21:11:57:46 VALID N N N 1 NONE N Y

            SQL> desc dual
            Name Null? Type
            ----- ----- -----------
            DUMMY VARCHAR2(1)

            SQL> SELECT * FROM dba_tables WHERE table_name = 'DUAL';

            OWNER TABLE_NAME TABLESPACE_NAME CLUSTER_NAME IOT_NAME STATUS PCT_FREE PCT_USED INI_TRANS MAX_TRANS INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS PCT_INCREASE FREELISTS FREELIST_GROUPS LOG B NUM_ROWS BLOCKS EMPTY_BLOCKS AVG_SPACE CHAIN_CNT AVG_ROW_LEN AVG_SPACE_FREELIST_BLOCKS NUM_FREELIST_BLOCKS DEGREE INSTANCES CACHE TABLE_LO SAMPLE_SIZE LAST_ANA PAR IOT_TYPE T S NES BUFFER_ FLASH_C CELL_FL ROW_MOVE GLO USE DURATION SKIP_COR MON CLUSTER_OWNER DEPENDEN COMPRESS COMPRESS_FOR DRO REA SEG RESULT_ CLU ACTIVITY_TRACKING DML_TIMESTAMP HAS CON INMEMORY INMEMORY INMEMORY_DISTRI INMEMORY_COMPRESS INMEMORY_DUPL
            ----- ---------- --------------- ------------ -------- -------- -------- -------- --------- --------- -------------- ----------- ----------- ----------- ------------ ---------- --------------- — - -------- ------ ------------ --------- --------- ----------- ------------------------- ------------------- ------ ---------- ----- -------- ----------- -------- — ------------ - - — ------- ------- ------- -------- — --- -------- -------- — ------------- -------- -------- ------------ — --- — ------- — ----------------- ------------- — --- -------- -------- --------------- ----------------- -------------
            SYS DUAL SYSTEM VALID 10 40 1 255 32768 1048576 1 2147483645 1 1 YES N 1 1 0 0 0 2 0 0 1 1 N ENABLED 1 23.10.17 NO N N NO DEFAULT DEFAULT DEFAULT DISABLED YES NO DISABLED YES DISABLED DISABLED NO NO YES DEFAULT NO NO NO DISABLED

            oli Oli Sennhauser added a comment - SQL> SELECT * FROM dba_objects WHERE object_name IN ('DUAL', 'DBMS_OUTPUT'); OWNER OBJECT_NAME SUBOBJECT_NAME OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE CREATED LAST_DDL TIMESTAMP STATUS T G S NAMESPACE EDITION_NAME SHARING E O ------ ----------- -------------- ---------- -------------- ----------- -------- -------- ------------------- ------- - - - ---------- ----------- ------- - - SYS DUAL 142 142 TABLE 21.03.16 21.03.16 2016-03-21:11:57:46 VALID N N N 1 NONE Y PUBLIC DUAL 143 SYNONYM 21.03.16 21.03.16 2016-03-21:11:57:46 VALID N N N 1 NONE N Y SYS DBMS_OUTPUT 999 999 PACKAGE 21.03.16 21.03.16 2016-03-21:11:57:46 VALID N N N 1 NONE Y PUBLIC DBMS_OUTPUT 1000 SYNONYM 21.03.16 21.03.16 2016-03-21:11:57:46 VALID N N N 1 NONE N Y SQL> desc dual Name Null? Type ----- ----- ----------- DUMMY VARCHAR2(1) SQL> SELECT * FROM dba_tables WHERE table_name = 'DUAL'; OWNER TABLE_NAME TABLESPACE_NAME CLUSTER_NAME IOT_NAME STATUS PCT_FREE PCT_USED INI_TRANS MAX_TRANS INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS PCT_INCREASE FREELISTS FREELIST_GROUPS LOG B NUM_ROWS BLOCKS EMPTY_BLOCKS AVG_SPACE CHAIN_CNT AVG_ROW_LEN AVG_SPACE_FREELIST_BLOCKS NUM_FREELIST_BLOCKS DEGREE INSTANCES CACHE TABLE_LO SAMPLE_SIZE LAST_ANA PAR IOT_TYPE T S NES BUFFER_ FLASH_C CELL_FL ROW_MOVE GLO USE DURATION SKIP_COR MON CLUSTER_OWNER DEPENDEN COMPRESS COMPRESS_FOR DRO REA SEG RESULT_ CLU ACTIVITY_TRACKING DML_TIMESTAMP HAS CON INMEMORY INMEMORY INMEMORY_DISTRI INMEMORY_COMPRESS INMEMORY_DUPL ----- ---------- --------------- ------------ -------- -------- -------- -------- --------- --------- -------------- ----------- ----------- ----------- ------------ ---------- --------------- — - -------- ------ ------------ --------- --------- ----------- ------------------------- ------------------- ------ ---------- ----- -------- ----------- -------- — ------------ - - — ------- ------- ------- -------- — --- -------- -------- — ------------- -------- -------- ------------ — --- — ------- — ----------------- ------------- — --- -------- -------- --------------- ----------------- ------------- SYS DUAL SYSTEM VALID 10 40 1 255 32768 1048576 1 2147483645 1 1 YES N 1 1 0 0 0 2 0 0 1 1 N ENABLED 1 23.10.17 NO N N NO DEFAULT DEFAULT DEFAULT DISABLED YES NO DISABLED YES DISABLED DISABLED NO NO YES DEFAULT NO NO NO DISABLED

            We briefly discussed this task with cvicentiu. Synonyms can fit well into mysql.proc table:

            MariaDB [test]> select * from mysql.proc\G
            *************************** 1. row ***************************
                              db: test
                            name: AddGeometryColumn
                            type: SYNONYM_PROCEDURE
                            body: AddGeometryColumn FOR mysql.AddGeometryColumn
            ...
            *************************** 2. row ***************************
                              db: test
                            name: proc
                            type: SYNONYM_TABLE
                            body: proc FOR mysql.proc
            ...
            *************************** 3. row ***************************
                              db: test
                            name: user
                            type: SYNONYM_VIEW
                            body: user FOR mysql.user
            ...
            

            This way we get authentication and mysqldump support for synonyms almost for free (with very little changes needed).

            bar Alexander Barkov added a comment - We briefly discussed this task with cvicentiu . Synonyms can fit well into mysql.proc table: MariaDB [test]> select * from mysql.proc\G *************************** 1. row *************************** db: test name : AddGeometryColumn type: SYNONYM_PROCEDURE body: AddGeometryColumn FOR mysql.AddGeometryColumn ... *************************** 2. row *************************** db: test name : proc type: SYNONYM_TABLE body: proc FOR mysql.proc ... *************************** 3. row *************************** db: test name : user type: SYNONYM_VIEW body: user FOR mysql. user ... This way we get authentication and mysqldump support for synonyms almost for free (with very little changes needed).

            This would be a desirable feature even for those who don't use PL/SQL.

            f_razzoli Federico Razzoli added a comment - This would be a desirable feature even for those who don't use PL/SQL.

            We have several potential clients asking for this, and yes, there are work arounds such as creating a veiw, but these are messy. Please, raise this up to Product Management.

            roger.eisentrager@mariadb.com Roger Eisentrager added a comment - We have several potential clients asking for this, and yes, there are work arounds such as creating a veiw, but these are messy. Please, raise this up to Product Management.

            People

              Unassigned Unassigned
              oli Oli Sennhauser
              Votes:
              6 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.