Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Dec 16, 2009, at 11:19 AM, Erwin Brandstetter wrote:

> 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;

If you're allowed, you can use an untrusted procedural language.

Erik Jones, Database Administrator
Engine Yard
Support, Scalability, Reliability
866.518.9273 x 260
Location: US/Pacific
IRC: mage2k






-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux