inserting only new rows from csv file

Поиск
Список
Период
Сортировка
От Seb
Тема inserting only new rows from csv file
Дата
Msg-id 87k5csf22r.fsf@patagonia.sebmags.homelinux.org
обсуждение исходный текст
Ответы Re: inserting only new rows from csv file
Список pgsql-general
Hi,

I've seen some approaches to this problem, but I suspect there are
better ways.

A csv file is produced nightly, with the same table structure as a table
in a PostgreSQL database.  The file grows over time as new records are
added every day.  However, the rows in the file may not be sorted the
same way every day.

I need to isolate the new rows and insert them into the database table.
Before I start writing a script to do this, I need to decide whether to
do the comparison between the database table and the csv file: a) within
the database, or b) COPY'ing the table to a file and then do the
comparison.  I'm not very experienced with SQL, so am more comfortable
with the latter option using plain shell and awk.  Which route is best?
If a), I'd appreciate some SQL code to do it.  Thanks.


Cheers,

--
Seb

В списке pgsql-general по дате отправления:

Предыдущее
От: Mike Christensen
Дата:
Сообщение: Re: Index question regarding numeric operators
Следующее
От: "Dennis Brakhane"
Дата:
Сообщение: Re: Transactions within a function body