On 27-08-2009 19:49:37 -0400, Matthew Jones wrote:
On Thu, Aug 27, 2009 at 7:11 PM, Martin Kersten
wrote: Matthew Jones wrote: > I noticed that COPY...INTO for bulk loading requires that all fields be > present in the data file. Is there any way to use bulk loading and have > it honor the auto increment column or at least not have to specify every > column in the data file? How about adding the serial column after loading. It will be zero cost.
Adding a "serial" column won't be zero cost, and I doubt it will be possible, since it implies a NOT NULL constraint, which cannot be added to a to be added column. Technically you could do it, assuming that you would just start filling the column because you know what can be put into it, as is defined by the sequence.
The problem is, I am loading continously, and I need this field continuously.
So it seems you're using COPY INTO to regularly append batches of new data to your dataset. You do this because of performance reasons? Since COPY INTO is designed for loading (restoring) a database, is it perhaps possible to use prepared statement batching instead? That allows you to have the sequence column(s) do their job.