From: | "Anton Stckl" <tony(at)cys(dot)de> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | dump data into table with sequence |
Date: | 1998-05-13 10:24:27 |
Message-ID: | 355974DB.5A698F16@cys.de |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Given this table:
Table = rechnung_kunde_199805
+----------------------------------+-------------------------------------+-------+
| Field | Type
| Length|
+----------------------------------+-------------------------------------+-------+
| rechnungs_id | int4 default nextval ( 're_id_seq')
| 4 |
| kunden_nr | int4
| 4 |
| stream_name | varchar()
| 40 |
| offset | int4
| 4 |
| length | int4
| 4 |
| datum | date
| 4 |
+----------------------------------+-------------------------------------+-------+
There is a unique index on rechnungs_id and a sequence 're_id_seq'.
I want to insert loads of data into this table -> 'psql DB <
data.sql'
data.sql is like: 'COPY .. FROM stdin;' __data__ \.
and the 'first field == rechnungs_id' in the data is empty (just a tab).
This doesn't work as PG tries to insert NULL as value for rechnungs_id
instead of
using the sequence.
Q: Is there a way to solve that problem other then defining a trigger?
If not:
Q: Can someone give me an example how to define the trigger (and the
procedure?) here?
I have read the docs (+ the contrib stuff), but still don't know exactly
how to
implement that.
regards, Tony
--
----------C-Y-B-E-R-S-O-L-U-T-I-O-N-S----------------
Anton Stöckl mailto:tony(at)cys(dot)de
CyberSolutions GmbH http://www.cys.de
Frankfurter Ring 193A Phone +49 89 32369223
80807 Muenchen Fax +49 89 32369220
------W-E----M-A-K-E----I-T----P-O-S-S-I-B-L-E-------
From | Date | Subject | |
---|---|---|---|
Next Message | The Hermit Hacker | 1998-05-13 17:59:27 | Copy error |
Previous Message | The Hermit Hacker | 1998-05-13 01:46:20 | updateable cursors |