Re: A table with two names or table alias - Mailing list pgsql-sql

From Igor Neyman
Subject Re: A table with two names or table alias
Date
Msg-id F4C27E77F7A33E4CA98C19A9DC6722A2033A7FAA@EXCHANGE.corp.perceptron.com
Whole thread Raw
In response to A table with two names or table alias  (Tk421 <vrobador@gmail.com>)
List pgsql-sql
There are no synonyms in Postgres (like in Oracle).
To implement what you want, you need to use views and rules.
From Postgres docs:
"Currently, views are read only: the system will not allow an insert,
update, or delete on a view. You can get the effect of an updatable view
by creating rules that rewrite inserts, etc. on the view into
appropriate actions on other tables."

Read docs on views and rules.

HTH,
Igor

-----Original Message-----
From: pgsql-sql-owner@postgresql.org
[mailto:pgsql-sql-owner@postgresql.org] On Behalf Of Tk421
Sent: Friday, July 25, 2008 8:13 AM
To: pgsql-sql@postgresql.org
Subject: [SQL] A table with two names or table alias
   Can I create a table name alias?
   What i want is to access the same table with two different names. An
example:
   I've the table CITY with fields code and name. I want to know if i
can create an alternative name to table CITY, like LOCATION, to make
possible these two sentences:
      insert into CITY values (10, 'New York');      insert into LOCATION values (11, 'Paris')
   Thank you.

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make
changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



pgsql-sql by date:

Previous
From: Emi Lu
Date:
Subject: Re: Query prepared plan
Next
From: Tom Lane
Date:
Subject: Re: Query prepared plan