Обсуждение: Posting COPY data with shared sequences

Поиск
Список
Период
Сортировка

Posting COPY data with shared sequences

От
Robert Fitzpatrick
Дата:
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