Re: writing a function to mimic mysql last_insert_id
От | Ross J. Reedstrom |
---|---|
Тема | Re: writing a function to mimic mysql last_insert_id |
Дата | |
Msg-id | 20020911173220.GE8991@rice.edu обсуждение исходный текст |
Ответ на | writing a function to mimic mysql last_insert_id ("Beth Gatewood" <beth@vizxlabs.com>) |
Список | pgsql-sql |
Beth - Take a look at pgsql's sequences. They do pretty much exactly what you want, here. There's even a 'pseudo type' serial that sets up an int column with a default value coming from a sequence. Sequences are more loosely couple to 'auto increment' columns than in mysql or other database systems. This is sometimes a bit of a pain (in order to retreive the lsat value, you need to know the name of the sequence, not just the table.column) but also more powerful: you can set up columns in several tables that draw from one sequence, for example, which will guarantee non-colliding values. Ross -- Ross Reedstrom, Ph.D. reedstrm@rice.edu Executive Director phone: 713-348-6166 Gulf Coast Consortium for Bioinformatics fax: 713-348-6182 Rice University MS-39 Houston, TX 77005 On Wed, Sep 11, 2002 at 10:23:35AM -0700, Beth Gatewood wrote: > Hi all- > > I am wondering if I can get some input on the logic that I would need to > code a function that would mimic mysql's last_insert_id().. <snip description of mysql's auto increment feature>
В списке pgsql-sql по дате отправления: