On Sunday 21 October 2012, Andres Freund wrote:
> On Sunday, October 21, 2012 07:24:52 PM Andrew Dunstan wrote:
> > why does the client have to be involved, exactly?
> Suppose you have something like
> CREATE TABLE positionlog(
> ...
> And you want to insert multiple values in one roundtrip *and* know their
> ids in your application.
> INSERT INTO positionlog(position)
>     ('POINT(..., ...)'),
>     ('POINT(..., ...)')
> RETURNING id, timestamp, position
> ;
> If you want to correlate re returned ids with data in your application
> without relying on the ordering of INSERT ... VALUES... RETURNING you
> would need to sort a postgis type in the same way the server does it.
> Am I missing something here?

That's close enough to my case: you would have to guess from (timestamp, 
position) the order they have with respect to your [(timestamp, pos),...] 
input array. That's not always trivial to do client-side (what about duplicate 
pairs? ), let alone the CPU needed to sort and match again.

Say NO to spam and viruses. Stop using Microsoft Windows!

Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:

Reply via email to