From: | Bob Pawley <rjpawley(at)shaw(dot)ca> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Michael Fuhr <mike(at)fuhr(dot)org>, Postgresql <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Inserting Data |
Date: | 2006-08-24 02:34:43 |
Message-ID: | 010a01c6c725$df6b8200$8e904618@owner |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Let me explain.
I have a table called p_id.devices which accumulates the devices_id for a
multitude of differing devices used in P&ID development.(Process
Engineering)
I also have a table called library.devices which is ( or soon will be ) a
detailed explanation of all of the particular devices available.
I accumulate the device_ids of the devices used during the P&ID development.
What I need to do now is distribute the various devices to their own tables
(Loops as well as others) based on the information found in the
library.devices table. I'm trying to make best use of the relationship
features of a relational data base.
However, I am frustrated by what appears to be a restrictive use of simple
logic. I am sure there is a reason for developing general SQL and PostgreSQL
in the manner in which it has developed. I am just trying to parse the
details behind the structure as best I can.
Bob
----- Original Message -----
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>
Sent: Wednesday, August 23, 2006 4:44 PM
Subject: Re: [GENERAL] Inserting Data
> 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
From | Date | Subject | |
---|---|---|---|
Next Message | Jasbinder Bali | 2006-08-24 05:03:43 | Shared Objects (Dynamic loading) |
Previous Message | Brent Wood | 2006-08-24 02:30:05 | Help needed defining timestamp format for input? |