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.  (Pavel Stehule <pavel.stehule@gmail.com>)
Re: How to get text for a plpgsql variable from a file.  ("Greg Sabino Mullane" <greg@turnstep.com>)
Re: How to get text for a plpgsql variable from a file.  (Erik Jones <ejones@engineyard.com>)
Список 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 по дате отправления:

Предыдущее
От: Michael Clark
Дата:
Сообщение: Re: Possible causes for database corruption and solutions
Следующее
От: Tim Hart
Дата:
Сообщение: make check fails on OS X 10.6.2