From: | "Igor Neyman" <ineyman(at)perceptron(dot)com> |
---|---|
To: | "Tk421" <vrobador(at)gmail(dot)com>, <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: A table with two names or table alias |
Date: | 2008-07-25 15:25:53 |
Message-ID: | F4C27E77F7A33E4CA98C19A9DC6722A2033A7FAA@EXCHANGE.corp.perceptron.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)postgresql(dot)org
[mailto:pgsql-sql-owner(at)postgresql(dot)org] On Behalf Of Tk421
Sent: Friday, July 25, 2008 8:13 AM
To: pgsql-sql(at)postgresql(dot)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(at)postgresql(dot)org) To make
changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2008-07-25 17:20:43 | Re: Query prepared plan |
Previous Message | Emi Lu | 2008-07-25 14:27:45 | Re: Query prepared plan |