Re: "SQL" REPLACE SYNTAX

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



> 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



[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux