Rushabh Lathia <rushabh.lat...@gmail.com> writes: > On Thu, Jul 3, 2014 at 6:56 AM, Ian Barwick <i...@2ndquadrant.com> wrote: >> A better solution would be to have an optional "IF EXISTS" clause: >> RETURNING PRIMARY KEY [ IF EXISTS ]
> Hmm liked the idea about adding [ IF EXISTS ]. Looking at the grammar so > far we > having [ IF EXISTS ] option only for DDL commands (mainly DROP) not sure > whether > its ok to use such syntax for DML commands. > Others please share your thoughts/comments. TBH, I thought that RETURNING PRIMARY KEY was already fairly iffy in that the application would have little idea what it was getting back. IF EXISTS would make it so spongy as to be useless, IMO. It sounds to me like designing this for JDBC's getGeneratedKeys method is a mistake. There isn't going to be any way that the driver can support that without having looked at the table's metadata for itself, and if it's going to do that then it doesn't need a crutch that only partially solves the problem anyhow. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers