Re: "RETURNING PRIMARY KEY" syntax extension

From: Jochem van Dieten <jochemd(at)gmail(dot)com>
To: Ian Barwick <ian(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: "RETURNING PRIMARY KEY" syntax extension
Date: 2014-06-12 11:58:31
Message-ID: CABPCP-3N3UU_QwFQJ1Zvv4ULas75TMihJvK5N864QJkUC2KiQA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 12, 2014 at 12:25 PM, Ian Barwick wrote:

> On 14/06/12 18:46, Jochem van Dieten wrote:
> > I haven't checked the code, but I am hoping it will help with the problem
> > where a RETURNING * is added to a statement that is not an insert or
> update
> > by the JDBC driver. That has been reported on the JDBC list at least
> twice,
> > and the proposed workaround is neither very elegant nor very robust:
> >
> https://groups.google.com/forum/#!msg/pgsql.interfaces.jdbc/7WY60JX3qyo/-v1fqDqLQKwJ
>
> Unfortunately that seems to be a JDBC-specific issue, which is outside
> of the scope of this particular patch (which proposes additional
> server-side
> syntax intended to make RETURNING * operations more efficient for
> certain use cases, but which is in itself not a JDBC change).
>

But the obvious way to fix the JDBC issue is not to fix it by adding a
'mini parser' on the JDBC side, but to make SELECT ... RETURNING PRIMARY
KEY a regular select that silently ignores the returning clause and doesn't
throw an error on the server-side.

That might still be outside the scope of this particular patch, but it
would provide (additional) justification if it were supported.

Jochem

--
Jochem van Dieten
http://jochem.vandieten.net/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2014-06-12 12:20:00 Re: "RETURNING PRIMARY KEY" syntax extension
Previous Message Fujii Masao 2014-06-12 11:51:36 Audit of logout