Search Postgresql Archives

Re: How to store text files in the postgresql?

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

 



* DimitryASuplatov:

> I`ve also worked out how to do this simply from bash
>
> ./bin/psql mypdb <<EOF
> insert into pdb values ('`cat /file/name`'); 
> EOF

This doesn't work if the file contains embedded "'" characters (and
backslashes and NULs are also problematic).  You will also get errors
if the file encoding does not match the database encoding.

You probably should use a BYTEA column and a little Perl script which
uses bind_param to specify a type of PG_BYTEA for the parameter.

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