Skip site navigation (1) Skip section navigation (2)

Re: Another proposal for table synonyms

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Alexey Klyukin <alexk(at)commandprompt(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Another proposal for table synonyms
Date: 2010-12-01 20:13:35
Message-ID: 4CF6AC6F.3050908@agliodbs.com (view raw or flat)
Thread:
Lists: pgsql-hackers
> Well, porting applications from other database systems that support synonyms
> (i.e. Oracle, DB2, SQL Server).

SQL Server supports synonyms?  If it's not Oracle-only, it's a more
powerful argument to have the feature.

(IMHO, the main reason why Oracle has synonyms is that their
implementation of SCHEMA is broken.)

There are two more arguments for table synonyms:

1. to support application versioning with an easier syntax than
updatable views.

2. to provide an alternative to the difficult-to-manage search_path

However, the latter does mean that there needs to be a fixed
order-of-resolution for synonyms which conflict with the name of objects
in other schema.  And one which doesn't break backwards compatiblity.

I'd love to hear from someone at EDB: how are you dealing with synonym
name collisions right now?

> Is this the feature the community would benefit from? We can consider adding
> column synonyms if we won't hardwire synonyms to pg_class objects.

Actually, we'd just put that one in pg_attribute.  I worked out a
back-of-the-napkin design, and it wouldn't require any new tables.  A
new column, yes.  But no new catalog tables.

So, I don't support your idea of having a completely separate catalog.
Sorry.

The use case for simple column synonyms is supporting application
versioning by allowing changes to column names without needing to
refactor all applications.  Later, we could also implement "calculated
columns" where the synonym points to an expression rather than a direct
column link.  All sorts of use cases for that.

-- 
                                  -- Josh Berkus
                                     PostgreSQL Experts Inc.
                                     http://www.pgexperts.com

In response to

Responses

pgsql-hackers by date

Next:From: Robert HaasDate: 2010-12-01 20:22:17
Subject: Re: Idle git question: how come so many "objects"?
Previous:From: Alexey KlyukinDate: 2010-12-01 19:46:48
Subject: Re: Another proposal for table synonyms

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group