Posting COPY data with shared sequences

From: Robert Fitzpatrick <robert(at)webtent(dot)com>
To: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: Posting COPY data with shared sequences
Date: 2004-11-19 19:12:46
Message-ID: 1100891565.21069.70.camel@columbus.webtent.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I share the same sequences across 3 tables and have a COPY that send
data to one of those tables. That table has a before insert trigger
function that looks for a condition and redirect records to the other
two depending on that condition result. Sharing the sequence is needed
to act as a primary key for the view that UNION ALL's the tables.

Since I'm posting all the data from one COPY command, the sequence
number is duplicated in the tables. Should I move the moving the trigger
function to after, which would require me to delete entries that get
moved -or- separate the different data into separate incoming COPY
commands? Anyone have suggestions on how I would best achieve what I'm
looking to do.

Thanks,
--
Robert

Browse pgsql-general by date

  From Date Subject
Next Message Matt 2004-11-19 19:23:08 Re: phpPgAdmin problem - this list?
Previous Message Jeremiah Jahn 2004-11-19 18:58:58 altre table and large object deletion