Re: bulk imports with sequence

Поиск
Список
Период
Сортировка
От Dan Langille
Тема Re: bulk imports with sequence
Дата
Msg-id 3D61F71C.23211.5F25BAFB@localhost
обсуждение исходный текст
Ответ на bulk imports with sequence  ("Aaron Held" <aaron@metrony.com>)
Список pgsql-sql
On 20 Aug 2002 at 7:55, Aaron Held wrote:

> I am importing a large number of records monthly using the \copy (from
> text file)command.
> 
> I would like to use a sequence as a unique row ID for display in my
> app.
> 
> Is there any way to let postgresql generate the sequence itself. 
> Currently the only way I can make it work is to grab the next seq
> value and insert my own numbers into the file

Yes: 

create sequence mytable_id_seq;
alter table mytable alter column id set default 
nextval('mycolumn_id_seq'::text);
-- 
Dan Langille
I'm looking for a computer job:
http://www.freebsddiary.org/dan_langille.php



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

Предыдущее
От: "Aaron Held"
Дата:
Сообщение: bulk imports with sequence
Следующее
От: "Darrin Domoney"
Дата:
Сообщение: Event recurrence - in database or in application code ????