| От | Joe Conway |
|---|---|
| Тема | Re: writing a function to mimic mysql last_insert_id |
| Дата | |
| Msg-id | 3D8004E4.80004@joeconway.com обсуждение |
| Ответ на | Re: writing a function to mimic mysql last_insert_id ("Beth Gatewood" <beth@vizxlabs.com>) |
| Список | pgsql-sql |
Beth Gatewood wrote:
> well, I know that I will have only a single sequence that will generate the
> primary key per table. So basically, this type of function, for me needs
> only to return the value of the primary key.
>
> I believe I mentioned in one of my posts the motivation behind not wanting
> to use currval()...which was to trying to avoid having the developers make a
> lot of sql revisions to their application.
Maybe you could use the *same* sequence for the primary key of all the tables,
say "my_global_seq" (it is bigint as of 7.2 I think), and then wrap a
last_insert_id() (or whatever it is called) function around a call to
currval('my_global_seq').
HTH,
Joe
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера