Re: How to store text files in the postgresql? - Mailing list pgsql-general

From Florian Weimer
Subject Re: How to store text files in the postgresql?
Date
Msg-id 87y6s41k9q.fsf@mid.deneb.enyo.de
Whole thread Raw
In response to Re: How to store text files in the postgresql?  (DimitryASuplatov <genesup@gmail.com>)
List pgsql-general
* 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.

pgsql-general by date:

Previous
From: Craig Ringer
Date:
Subject: Re: limit table to one row
Next
From: Peter Eisentraut
Date:
Subject: Re: xml to table (as oppose to table to xml)