Re: Inserting Data

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bob Pawley <rjpawley(at)shaw(dot)ca>
Cc: Michael Fuhr <mike(at)fuhr(dot)org>, Postgresql <pgsql-general(at)postgresql(dot)org>
Subject: Re: Inserting Data
Date: 2006-08-23 23:44:54
Message-ID: 25846.1156376694@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Bob Pawley <rjpawley(at)shaw(dot)ca> writes:
> What I have is one table which stores device_id numbers that are referenced
> on the second table "library.devices".
> I need to insert device_ids from the first table that satisfy the conditions
> of the argument found on the library table. Hence the 'where' clause.

This isn't real clear to me, but perhaps you are looking for something
like

IF EXISTS(select 1 from library.devices where ...) THEN
INSERT INTO ... values(new.device_id);
END IF;

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tim Allen 2006-08-23 23:59:05 Re: How do i store arbitrary questions and answers in SQL?
Previous Message Tom Lane 2006-08-23 23:42:32 Re: CASCADING could not open relation with OID