Re: COPY data into a table with a SERIAL column?

Поиск
Список
Период
Сортировка
Искать
От
Rob Sargent
Тема
Re: COPY data into a table with a SERIAL column?
Дата
Msg-id
543FF58B.9050705@gmail.com
Ответ на
Список
Дерево обсуждения
COPY data into a table with a SERIAL column? Steve Wampler <swampler@noao.edu>
Re: COPY data into a table with a SERIAL column? Rob Sargent <robjsargent@gmail.com>
Re: COPY data into a table with a SERIAL column? Steve Wampler <swampler@noao.edu>
Re: COPY data into a table with a SERIAL column? David G Johnston <david.g.johnston@gmail.com>
Re: COPY data into a table with a SERIAL column? Rob Sargent <robjsargent@gmail.com>
Re: COPY data into a table with a SERIAL column? Steve Wampler <swampler@noao.edu>
Re: COPY data into a table with a SERIAL column? Adrian Klaver <adrian.klaver@aklaver.com>
Re: COPY data into a table with a SERIAL column? Rob Sargent <robjsargent@gmail.com>
Re: COPY data into a table with a SERIAL column? David G Johnston <david.g.johnston@gmail.com>
Re: COPY data into a table with a SERIAL column? Rob Sargent <robjsargent@gmail.com>
On 10/16/2014 10:33 AM, Steve Wampler wrote:

Hi,

This is with Postgresql 9.3.5.

I'm looking at using a COPY command (via jdbc) to do bulk inserts into a table that
includes a BIGSERIAL column.   Is there a way to mark the data in that
column so it gets assigned a new value on entry - akin to the use of 'default'
in an INSERT?   Some of the rows have values for the serial column, others
don't.

Or is the only way to use COPY for this task:

  COPY table_name (columnnameA, columnnameB, columnnameD) FROM source;

where the serial column name is omitted?  This wouldn't preserve the values
for the serial column on rows that have one already.

Thanks!
Steve
Doesn't this guarantee collision at some point?

I might add a column to the target table which would contain the "foreign" serial id and give all records the "local" serial.  Update local to foreign iff safe and desired.


В списке pgsql-general по дате отправления
От: Steve Wampler
Дата:
От: snacktime
Дата:
Сообщение: Misunderstanding deadlocks
FAQ