Обсуждение: Re: [NOVICE] Last ID Problem

Поиск
Список
Период
Сортировка

Re: [NOVICE] Last ID Problem

От
"John Hansen"
Дата:
> > Since OID's are now deprecated, and will eventually disappear,
> > wouldn't it be a good idea, to have INSERT and UPDATE
> return a copy of
> > the tuple that was inserted/updated?
>
> How about the TID?

Yea, that'd work. As long as you can get an arbitrary column back out, 'as it was at the time it was committed'.

Since not everything runs in a transaction,. And someone might have modified the row by the time you get to fetching it
backout.... 

Or in terms of tuples,. No longer exist, if vacuum full have run...

... JOhn

Re: [NOVICE] Last ID Problem

От
Tom Lane
Дата:
"John Hansen" <john@geeknet.com.au> writes:
>>> Since OID's are now deprecated, and will eventually disappear,

No one has stated that they will disappear.

>>> wouldn't it be a good idea, to have INSERT and UPDATE
>>> return a copy of the tuple that was inserted/updated?
>>
>> How about the TID?

> Yea, that'd work.

You could only trust it for the duration of the inserting or updating
transaction.  Which might be enough ... but changing it would certainly
break all existing apps that use this feature.

I think the correct solution is not to mess with what's admittedly a
legacy aspect of our client API.  Instead we should invent the "INSERT
RETURNING" and "UPDATE RETURNING" commands that have been discussed
repeatedly (see the pghackers archives).  That would allow people to get
what they want, and do so in only one network round trip, without any
artificial dependencies on OIDs or TIDs or anything else.  It'd be
unportable, but surely no more so than relying on OIDs or TIDs ...

            regards, tom lane

Re: [NOVICE] Last ID Problem

От
John Hansen
Дата:
> No one has stated that they will disappear.

Ohh,... just the impression I've been getting when speaking with people.

... John