| От | Tom Lane |
|---|---|
| Тема | Re: Nocount and scope_identity() |
| Дата | |
| Msg-id | 23776.1170448113@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: Nocount and scope_identity() (Andrew Sullivan <ajs@crankycanuck.ca>) |
| Список | pgsql-sql |
Andrew Sullivan <ajs@crankycanuck.ca> writes:
> On Fri, Feb 02, 2007 at 01:38:40PM -0600, Demel, Jeff wrote:
>>>> SCOPE_IDENTITY() method is going to work or not.
>>> I doubt it. What does it do?
>>
>> It returns the id of the record just inserted.
> Ah. Well, there's no in-principle notion if "id" in Postgres (OIDs
> are optional as of several versions ago). But if you have a primary
> key that's an integer you populate using a sequence, then you can use
> the currval() function to get the value of the sequence.
Also, as of 8.2 INSERT RETURNING is a good way to collect the value
of an auto-generated key field (or any other auto-generated field...)
regards, tom lane
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера