Re: PQoidValue - get last ID of primary key after INSERT - small

Поиск
Список
Период
Сортировка
От Georgi Kolev
Тема Re: PQoidValue - get last ID of primary key after INSERT - small
Дата
Msg-id ebi92p$8ae$1@sea.gmane.org
обсуждение исходный текст
Ответ на Re: PQoidValue - get last ID of primary key after INSERT - small fix  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: PQoidValue - get last ID of primary key after INSERT - small  (Gregory Stark <gsstark@mit.edu>)
Список pgsql-interfaces
Hi Tom,

Tom Lane wrote:
> Georgi Kolev <geo_kolev@mail.ru> writes:
>> The easiest way to fix the problem were to fix heap_insert() to get the 
>> right value in case there is no OID column declared in the table.
> 
> Not a chance.  I could make a list of objections to that that's longer
> than your patch, but the short of it is that this is a completely
> inappropriate level of the system to be doing that kind of work in.
> 

My basic idea was to implement such functionality as in Sybase and MSSQL 
Server, I mean the @@identity system variable, which is filled with the 
identity column of the last INSERT statement executed. I just needed 
some simple solution to fix the problem. Now it works perfectly for me.

> What we *are* working on is INSERT RETURNING (in fact I'm about to start
> work on reviewing/committing that patch right now...), which is a much
> more general solution to the problem.
> 
>             regards, tom lane
> 

I agree that the solution INSERT...RETURNING is more general and 
flexible. But I think if we have such a solution as @@identity as in 
Sybase, PostgreSQL will be much more compatible and adoptable for 
migrations.

Regards, Georgi Kolev



В списке pgsql-interfaces по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: PQoidValue - get last ID of primary key after INSERT - small fix
Следующее
От: Andro
Дата:
Сообщение: leaving out paramTypes parameter