Re: Incomprehensible behaviour of a foreign key.

Поиск
Список
Период
Сортировка
От Nigel J. Andrews
Тема Re: Incomprehensible behaviour of a foreign key.
Дата
Msg-id Pine.LNX.4.21.0307211800050.18610-100000@ponder.fairway2k.co.uk
обсуждение исходный текст
Ответ на Re: Incomprehensible behaviour of a foreign key.  (Kathy Zhu <Kathy.Zhu@Sun.COM>)
Список 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


В списке pgsql-general по дате отправления:

Предыдущее
От: Chris Gamache
Дата:
Сообщение: pg_dump dies on a renamed sequence... (7.2)
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: Why does it not use the index?