Re: Inserting .png file into bytea column

From: Achilleas Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
To: "Ferrell, Denise D CTR NSWCDD, H11" <denise(dot)ferrell(dot)ctr(at)navy(dot)mil>, pgsql-admin(at)postgresql(dot)org
Subject: Re: Inserting .png file into bytea column
Date: 2015-11-19 14:19:02
Message-ID: 564DDA56.7030809@matrix.gatewaynet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On 19/11/2015 16:07, Ferrell, Denise D CTR NSWCDD, H11 wrote:
> Good Morning All,
>
> I am using PostgreSQL 9.3 on Linux Rehat...
>
> I'm trying to insert an image (.png format) into a table of flags. I've tried the following but keep getting errors.
>
> CREATE TABLE FLAGS (country_code text, flag bytea);
>
> INSERT INTO flags VALUES ('AD', pg_read_file('/home/flags')::bytea);
>
> Get the following error:
> ERROR: absolute path not allowed
> *********ERROR*************
> ERROR: absolute path not allowed
> SQL State: 42501
>
> Any assistance would be greatly appreciated.

http://www.postgresql.org/docs/9.2/static/functions-admin.html#FUNCTIONS-ADMIN-GENFILE

use |pg_read_binary_file(filename text [, offset bigint, length bigint])| as documented

>
> Denise Ferrell

--
Achilleas Mantzios
IT DEV Lead
IT DEPT
Dynacom Tankers Mgmt

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Craig James 2015-11-19 15:09:24 Re: Inserting .png file into bytea column
Previous Message Campbell, Lance 2015-11-19 14:11:38 postgresql.conf