pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Re: popstgresql query
2+ messages / 2 participants
[nested] [flat]

* Re: popstgresql query
@ 2004-01-19 18:40 Arun Gananathan <arun@gananathan.fslife.co.uk>
  2004-01-26 17:39 ` Re: popstgresql query scott.marlowe <scott.marlowe@ihs.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Arun Gananathan @ 2004-01-19 18:40 UTC (permalink / raw)
  To: pgsql-admin

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.
Thank you

arun

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: popstgresql query
  2004-01-19 18:40 Re: popstgresql query Arun Gananathan <arun@gananathan.fslife.co.uk>
@ 2004-01-26 17:39 ` scott.marlowe <scott.marlowe@ihs.com>
  0 siblings, 0 replies; 2+ messages in thread

From: scott.marlowe @ 2004-01-26 17:39 UTC (permalink / raw)
  To: Arun Gananathan <arun@gananathan.fslife.co.uk>; +Cc: 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?




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2004-01-26 17:39 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-01-19 18:40 Re: popstgresql query Arun Gananathan <arun@gananathan.fslife.co.uk>
2004-01-26 17:39 ` scott.marlowe <scott.marlowe@ihs.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox