From: | "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au> |
---|---|
To: | "Francisco Reyes" <lists(at)natserv(dot)com> |
Cc: | "Manuel Lemos" <mlemos(at)acm(dot)org>, "PostgresSQL PHP list" <pgsql-php(at)postgresql(dot)org> |
Subject: | Re: "SQL" REPLACE SYNTAX |
Date: | 2002-01-23 03:56:34 |
Message-ID: | GNELIHDDFBOCMGBFGEFOOECHCBAA.chriskl@familyhealth.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-php |
> Why so many? It is simple enough to attempt a delete and then do an
> insert.
DELETE WHERE what? Alternatively you can attempt and update then do an
insert - question is UPDATE WHERE what?
If the insert fails you need to select from the postgres system catalogs to
find the primary key on the table (if there is one). Next, you need to find
the fields that that primary key is defined over. Next, you need to parse
the insert statement and find the fields being inserted that match the
primary key. Lastly you need to modify the insert statment to an update
statment, take out the values that are part of the primary key and make them
part of the where clause of the update or delete statement.
Chris
From | Date | Subject | |
---|---|---|---|
Next Message | Manuel Lemos | 2002-01-23 04:39:22 | Re: "SQL" REPLACE SYNTAX |
Previous Message | Francisco Reyes | 2002-01-23 03:54:12 | Re: Long running queries and timeouts |