From: | Ragnar <gnari(at)hive(dot)is> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Proposal for SYNONYMS |
Date: | 2006-03-10 23:21:35 |
Message-ID: | 1142032895.18656.194.camel@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On fös, 2006-03-10 at 16:51 -0500, Tom Lane wrote:
> Kris Jurka <books(at)ejurka(dot)com> writes:
> > One key difference would be that synonyms track schema updates, like
> > adding a column, to the referenced object that a view would not.
>
> That raises a fairly interesting point, actually. What would you expect
> to happen here:
>
> CREATE TABLE foo ...;
> CREATE SYNONYM bar FOR foo;
> CREATE VIEW v AS SELECT * FROM bar;
> DROP SYNONYM bar;
>
> With the implementations being proposed, v would effectively be stored
> as "SELECT * FROM foo" and thus would be unaffected by the DROP SYNONYM.
> Is that what people will expect? Is it what happens in Oracle?
At least on Oracle8, you could create a synonym on a
non-existing table, so if table FOO does not exist:
CREATE SYNONYM BAR FOR FOO; -- no error
SELECT * FROM BAR; -- error "synonym translation is no longuer valid"
CREATE TABLE FOO (a varchar2(10));
INSERT INTO FOO VALUES ('a');
SELECT * FROM BAR; -- no error
CREATE VIEW X AS SELECT * FROM BAR;
SELECT * FROM X; -- no error
DROP SYNONYM X; -- no error
SELECT * FROM BAR; -- error
gnari
From | Date | Subject | |
---|---|---|---|
Next Message | Jaime Casanova | 2006-03-11 06:23:35 | There is a problem with the download site? |
Previous Message | Tom Lane | 2006-03-10 23:20:59 | Re: problem with large maintenance_work_mem settings and |