Proposal for SYNONYMS - Mailing list pgsql-hackers
From | Jonah H. Harris |
---|---|
Subject | Proposal for SYNONYMS |
Date | |
Msg-id | 36e682920603090835q291cae3aq4e2ca1d3a73cbef3@mail.gmail.com Whole thread Raw |
Responses |
Re: Proposal for SYNONYMS
Re: Proposal for SYNONYMS Re: Proposal for SYNONYMS Re: Proposal for SYNONYMS |
List | pgsql-hackers |
<p style="margin-bottom: 0in;">This email is a preliminary design for the implementation of synonyms in PostgreSQL. Commentsand suggestions are welcomed.<br /><p style="margin-bottom: 0in;">BACKGROUND<p style="margin-bottom: 0in;">Synonymsare database objects which can be used in place of their referenced object in SELECT, INSERT, UPDATE, and DELETESQL statements.<p style="margin-bottom: 0in;">There are two reasons to use synonyms which include:<p style="margin-bottom:0in;">- Abstraction from changes made to the name or location of database objects<br /> - Alternativenaming for another database object<p style="margin-bottom: 0in;">Similarly, RDBMS support for synonyms existsin Oracle, SQL Server, DB2, SAP DB/MAX DB, and Mimer. <p style="margin-bottom: 0in;">PROPOSED SQL ADDITIONS<p style="margin-bottom:0in;">CREATE SYNONYM qualified_name FOR qualified_name<br /> DROP SYNONYM qualified_name<p style="margin-bottom:0in;">In addition, SYNONYMS do participate in ACLs and support GRANT/REVOKE for table privileges. DROPTABLE and TRUNCATE cannot be used with synonyms.<p style="margin-bottom: 0in;">DESCRIPTION<p style="margin-bottom: 0in;">-A synonym can be created for a table, view, or synonym.<br /> - Synonyms can reference objects in any schema<p style="margin-bottom:0in;">RESTRICTIONS<p style="margin-bottom: 0in;">- A synonym may only be created if the creator hassome access privilege on the referenced object.<br /> - A synonym can only be created for an existing table, view or synonym.<br/> - A synonym name cannot be the same as the name of any other table, view or synonym which exists in the schemawhere the synonym is to be created. <p style="margin-bottom: 0in;">PROPOSED IMPLEMENTATION<p style="margin-bottom:0in;">- Introduce a new relkind for synonyms<br /> - Synonyms only act as pointers to a real objectby oid<br /> - Permission on a synonym does not override the permission on the referenced object<br /> - Referencedobjects becomes dependencies of the synonyms that reference them<br /> - Synonyms follow PostgreSQL's current search_pathbehavior<p style="margin-bottom: 0in;">RUNTIME COST<p style="margin-bottom: 0in;">- Dependent on database user/administrator<br/> - In catalog searches which do not reference a synonym, the only cost incurred is that of searchingthe additional number of synonym objects in the catalog<br /> - In catalog searches which use a synonym, an additionalcost is incurred to reference the real object<br /> - If no synonyms are created, no additional costs are incurred<br/><br />-- <br />Jonah H. Harris, Database Internals Architect<br />EnterpriseDB Corporation<br />732.331.1324<br/>
pgsql-hackers by date: