Re: RETURNING clause: how to specifiy column indexes?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: Ken Johanson <pg-user(at)kensystem(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: RETURNING clause: how to specifiy column indexes?
Date: 2007-12-12 07:01:03
Message-ID: 13400.1197442863@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-jdbc

Kris Jurka <books(at)ejurka(dot)com> writes:
> I think the expectation is that:

> CREATE TABLE t(a int, b int);
> INSERT INTO t(b,a) VALUES (1,2) RETURNING *;

> will return 1,2 instead of 2,1 as it does now.

Hmm ... I see your point, but on what grounds could one argue that
a "*" targetlist here should return something different from what
"SELECT * FROM t" would return?

I'd say that an app that wants that should write

INSERT INTO t(b,a) VALUES (1,2) RETURNING b,a;

which is surely not that hard if you've got the code to produce
the "(b,a)" part.

In any case it's not clear this is the same thing Ken is complaining
about ...

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Samantha Atkins 2007-12-12 07:14:51 Re: what is the date format in binary query results
Previous Message luca.ciciriello 2007-12-12 06:51:38 Re: POSIX and libpq

Browse pgsql-jdbc by date

  From Date Subject
Next Message Ken Johanson 2007-12-12 08:01:16 Re: RETURNING clause: how to specifiy column indexes?
Previous Message Kris Jurka 2007-12-12 06:45:09 Re: RETURNING clause: how to specifiy column indexes?