From: | "Nigel J(dot) Andrews" <nandrews(at)investsystems(dot)co(dot)uk> |
---|---|
To: | Kathy Zhu <Kathy(dot)Zhu(at)Sun(dot)COM> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Incomprehensible behaviour of a foreign key. |
Date: | 2003-07-21 17:07:18 |
Message-ID: | Pine.LNX.4.21.0307211800050.18610-100000@ponder.fairway2k.co.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, 21 Jul 2003, Kathy Zhu wrote:
> How can you have two tables with the same name in one database ??
> How do you differentiate them when you use it in queries ??
In different schemas. For example:
create schema first;
create schema second;
create table first.atable ( id serial primary key, value text );
create table second.atable ( id serial primary key, value text );
insert into first.atable (value) values ('this is in first schema');
insert into second.atable (value) values ('this is in second schema');
select * from second.atable;
select * from atable;
ERROR (possibly)
and then there is the search path:
set search_path to second, first;
select * from atable;
Gives: value == 'this is second schema'
Hope that helps.
--
Nigel J. Andrews
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2003-07-21 18:00:56 | Re: Why does it not use the index? |
Previous Message | Philip Greer | 2003-07-21 17:06:07 | Why does it not use the index? |