How to get text for a plpgsql variable from a file.

Поиск
Список
Период
Сортировка
От Erwin Brandstetter
Тема How to get text for a plpgsql variable from a file.
Дата
Msg-id edb0d0ce-b9c2-462c-9477-e7cd837ac2e4@19g2000vbq.googlegroups.com
обсуждение исходный текст
Ответы Re: How to get text for a plpgsql variable from a file.
Re: How to get text for a plpgsql variable from a file.
Re: How to get text for a plpgsql variable from a file.
Список pgsql-general
Hello,

    I need a long text form from a file in my plpgsql variable.
Can anyone think of a more straightforward way to read the file than
the following:


CREATE FUNCTION test() RETURNS void AS
$BODY$
DECLARE
    mytxt text;
BEGIN

CREATE TEMP TABLE x (x text);
COPY x from '/path/to/myfile.txt';
mytxt := (SELECT x from x);

...

END;
$BODY$
  LANGUAGE 'plpgsql' VOLATILE;



Regards
Erwin

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