Multiple inserts without COPY

Поиск
Список
Период
Сортировка
От Mark Lubratt
Тема Multiple inserts without COPY
Дата
Msg-id B1385542-6D86-11D8-BC23-000A9579AF50@indeq.com
обсуждение исходный текст
Ответы Re: Multiple inserts without COPY
Список pgsql-admin
Hello!

I have a routine in my application where I have the potential to
generate hundreds of inserts or deletes at one time.  Right now, I
issue each insert and delete separately.  I'm hoping there might be a
way of generating a single SQL statement to send to the backend for
each.  The deletes look something like

delete from CL where CL_id = i

where i could be a list of several hundred integers.  Again, right now
I iterate through the list.

The inserts might look like

insert into CL (CO_id, PE_ID) values (j, k)

where j and k are also integers and I could have a list of several
hundred pairs of j and k.

MySQL has a multiple insert feature where you simply append a bunch of
(j, k)'s separated by a comma.  Does PostgreSQL have anything like
this?  I was hoping I might be able to use COPY, but I see that's
really only for psql.

Are there any options?  Or, do I simply send a bunch of queries?

Thanks!
Mark


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: bizarre AGE behaviour
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Multiple inserts without COPY