Re: Using sequences in SQL text files
От
Richard Huxton
Тема
Re: Using sequences in SQL text files
Дата
Msg-id
47BAFBE2.4070407@archonet.com
Ответ на
Список
Дерево обсуждения
Using sequences in SQL text files HHB <hubaghdadi@yahoo.ca>
Re: Using sequences in SQL text files Raymond O'Donnell <rod@iol.ie>
Re: Using sequences in SQL text files Lone Wolf <hubaghdadi@yahoo.ca>
Re: Using sequences in SQL text files Richard Huxton <dev@archonet.com>
Re: Using sequences in SQL text files brian <brian@zijn-digital.com>
Re: Using sequences in SQL text files HHB <hubaghdadi@yahoo.ca>
Re: Using sequences in SQL text files Thomas <tburdairon@entelience.com>
Re: Using sequences in SQL text files intelforum@subtropolix.org
HHB wrote: > Hi. > I have sequence for each table in my database. > In order to populate same data in the database, I created some SQL text > files. > --- > insert into categories values (id value from sequence, '..', '...'); > insert into books values (id value from sequence, '..', '...', '..', fk to > category id); If they are of SERIAL type then they'll use their sequence by default: INSERT INTO my_table (id, a, b) VALUES (DEFAULT, 'abc', 123); Otherwise you can use the currval/nextval() functions: INSERT INTO my_table (id, a, b) VALUES (nextval(), 'abc', 123); -- Richard Huxton Archonet Ltd
В списке pgsql-general по дате отправления