| From: | rloefgren(at)forethought(dot)net |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | serial, sequence, and COPY FROM |
| Date: | 2006-09-12 16:27:55 |
| Message-ID: | 1158078475.423407.234120@e3g2000cwe.googlegroups.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
All,
I have a pipe delimited text file I'm trying to copy to a table. The
file has 17 fields per line. The table has 18, with that last field
(record) a serial with sequence. I have done:
select setval('sequence_name_seq', 555, 'TRUE')
but when I do: COPY tablename FROM '/path/to/file/file.txt' delimiter
'|'
the copy stops at the first row, insisting that it's missing data for
the field record. Well, yeah...
I can make this work with inserts but not with COPY FROM. What I've
been doing is dumping it into a mysql table with an auto_increment
field and then dumping that into a text file and using that for the
COPY FROM; certainly clumsy. How might this be done?
r
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Martijn van Oosterhout | 2006-09-12 16:29:48 | Re: Bytea to Text problems |
| Previous Message | Francisco Reyes | 2006-09-12 16:04:47 | Re: Superuser lost access to particular database |