Michael Glaesemann <grzm@myrealbox.com> writes:
> On Mar 7, 2006, at 17:29 , Hans-J�rgen Sch�nig wrote:
>> this patch implements CREATE SYNONYM
> Is this SQL spec or Oracle-specific?
This is not in the spec.
I'm inclined to reject this patch on the grounds that it doesn't do
what Oracle does and does not look like it could be extended to do what
Oracle does. My understanding is that what Oracle people mostly use
synonyms for is to provide cross-database access --- and this can't do
that. I'm not in favor of providing syntax compatibility if we don't
have functional compatibility; I think that isn't doing anyone any
favors. And if the behavior does get used, then we'd have a backwards
compatibility problem if anyone ever wants to do it right.
I'm also quite dubious that this would work properly, because it hooks
into table and function lookup in only one place respectively. It's
hard to believe that only one of the many lookups for tables and
functions needs to be changed.
The semantics of namespace search seem wrong; I would think that a
synonym in schema A should mask a table in schema B if A precedes B
on the search path, but this doesn't work that way.
I'm also not very happy about adding an additional catalog search to
function and table lookup, which are already quite expensive enough.
(The last two objections might both be addressed by forgetting the
notion of a separate catalog and instead making synonyms be alternative
kinds of entries in pg_class and pg_proc. However, that does nothing to
help with the cross-database problem, and might indeed hinder it.)
Just for the record, this is lacking pg_dump support as well as
documentation.
regards, tom lane