COPY FROM - how to identify results?

Поиск
Список
Период
Сортировка
От Jaime Silvela
Тема COPY FROM - how to identify results?
Дата
Msg-id 461284C2.30803@bear.com
обсуждение исходный текст
Ответ на Re: Webappication and PostgreSQL login roles  (Thorsten Kraus <TK-Spam@gmx.de>)
Ответы Re: COPY FROM - how to identify results?
Re: COPY FROM - how to identify results?
Список pgsql-general
I've written a web application where users can upload spreadsheets,
instead of having to key in forms. The spreadsheets get parsed and
INSERTED into a table, and with the INSERT gets added an identifier so
that I can always trace back what a particular row in the table
corresponds to.
I'd like to use COPY - FROM to achieve the same thing, but a stopping
point is that I don't see how to add the new spreadsheet with a
particular identifier.

I'd like to be able to do something like
COPY mytable (field-1, ..  field-n, id = my_id) FROM file; or
COPY mytable FROM file WITH id = my_id;

A very messy solution would be to create a temp table with a special
name, COPY to it, then INSERT from it to the permanent table. However, I
don't want a solution of that type.

I assume many people have this same problem. Any elegant solutions here?

Thanks
Jaime



***********************************************************************
Bear Stearns is not responsible for any recommendation, solicitation,
offer or agreement or any information about any transaction, customer
account or account activity contained in this communication.

Bear Stearns does not provide tax, legal or accounting advice.  You
should consult your own tax, legal and accounting advisors before
engaging in any transaction. In order for Bear Stearns to comply with
Internal Revenue Service Circular 230 (if applicable), you are notified
that any discussion of U.S. federal tax issues contained or referred to
herein is not intended or written to be used, and cannot be used, for
the purpose of:  (A) avoiding penalties that may be imposed under the
Internal Revenue Code; nor (B) promoting, marketing or recommending to
another party any transaction or matter addressed herein.
***********************************************************************

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

Предыдущее
От: Jonathan Vanasco
Дата:
Сообщение: Re: UPDATE on two large datasets is very slow
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BitmapScan mishaps