Bulk inserts within a Perl script?

Поиск
Список
Период
Сортировка
От Kynn Jones
Тема Bulk inserts within a Perl script?
Дата
Msg-id c2350ba40604181603m602b780dy1f905a7d83b151cb@mail.gmail.com
обсуждение исходный текст
Ответы Re: Bulk inserts within a Perl script?  (Steve Atkins <steve@blighty.com>)
Re: Bulk inserts within a Perl script?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Bulk inserts within a Perl script?  (Teodor Sigaev <teodor@sigaev.ru>)
Список pgsql-general
I have a Perl script that is supposed to make a large number of inserts in a PostgreSQL database.  Performing individual inserts with SQL's INSERT command is too slow, however, I can use a "COPY ... from stdin" approach that is fast enough.  Basically, I fork a psql process (yes, I'm on unix) and have the parent write the new records into the child, as part of a COPY from stdin command.  Admittedly, this is very convoluted, but it works.
 
Well, it almost works.  It did in my preliminary tests, but failed in the real run with the actual database because the owner of the tables that get modified by this COPY statement is a user for which the psql command requires a password ( i.e. this user exists solely for the purpose of owning the database in question; it does not have a UID, nor disk space assigned to it), and I don't know how to give this password programmatically.
 
So I'm back at the drawing board.  How can I make fast bulk inserts into a PostgreSQL database from within a Perl script?
 
Thanks!
 
kj
 

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Partial indexes
Следующее
От: Steve Atkins
Дата:
Сообщение: Re: Bulk inserts within a Perl script?