Re: popstgresql query

Поиск
Список
Период
Сортировка
От scott.marlowe
Тема Re: popstgresql query
Дата
Msg-id Pine.LNX.4.33.0401261038170.16241-100000@css120.ihs.com
обсуждение исходный текст
Ответ на Re: popstgresql query  ("Arun Gananathan" <arun@gananathan.fslife.co.uk>)
Список pgsql-admin
On Mon, 19 Jan 2004, Arun Gananathan wrote:

> Hi,
> Could anyone please let me know how to perform the following in
> postgresql
> I have two tables called P , Q  with the same attributes and data
> tpyes. I want to insert a record ( for example called A) into table P,
> when deleting the same record( for example  called A which is already in
> the other table)  from the other table Q.

Pretty straight ahead.  You can either use a fancy trigger setup, or just
do it in a transaction to ensure integrity:

begin;
insert into P (select * from Q where recid='A';
delete from Q where recid='A';
commit;

If the insert fails, the delete won't happen either.

That close to what you want?


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

Предыдущее
От: "Cleiton Becker"
Дата:
Сообщение: I want to quit
Следующее
От: Reece Hart
Дата:
Сообщение: Re: "mirroring" a table - PostgreSQL 7.3.2