bulk insertions in PL/pgsql functions

Поиск
Список
Период
Сортировка
От Richard Emberson
Тема bulk insertions in PL/pgsql functions
Дата
Msg-id 3C7ECBB9.32D8A7E1@phc.net
обсуждение исходный текст
Список pgsql-general
Rather than insert values one row at a time from a client to a backend
could one do a bulk load
using a function:

CREATE OR REPLACE FUNCTION bulk_load (
TEXT
)
RETURNS INTEGER AS '
DECLARE
    -- parameters
    text_p ALIAS FOR $1;
    -- local variables
    -- none
BEGIN
EXECUTE ''COPY some_table FROM stdin:''
    || text_p
    || ''\.''
    RETURN 1;
END;
' LANGUAGE 'plpgsql';

Here the argument would have to be of the correct rormat for the copy
command.
(Assume that there is not a shared filesystem so one can not write the
data to a file
and have it then loaded via a copy from filename command be used.)

Richard


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: killed select?
Следующее
От: Samik Raychauhduri
Дата:
Сообщение: Re: SQL statement : list table details