Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZzQ56-000747-9b for pgsql-admin@arkaria.postgresql.org; Thu, 19 Nov 2015 14:21:00 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZzQ55-0005Qf-SD for pgsql-admin@arkaria.postgresql.org; Thu, 19 Nov 2015 14:20:59 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZzQ3R-0003Su-UF for pgsql-admin@postgresql.org; Thu, 19 Nov 2015 14:19:18 +0000 Received: from host3.dynacom.ondsl.gr ([62.103.35.211] helo=smadev.internal.net) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1ZzQ3M-0000gg-My for pgsql-admin@postgresql.org; Thu, 19 Nov 2015 14:19:16 +0000 Received: from smadev.internal.net (smadev [10.9.200.131]) by smadev.internal.net (8.14.7/8.14.7) with ESMTP id tAJEJ2xd096268; Thu, 19 Nov 2015 16:19:02 +0200 (EET) (envelope-from achill@matrix.gatewaynet.com) Message-ID: <564DDA56.7030809@matrix.gatewaynet.com> Date: Thu, 19 Nov 2015 16:19:02 +0200 From: Achilleas Mantzios User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: "Ferrell, Denise D CTR NSWCDD, H11" , pgsql-admin@postgresql.org Subject: Re: Inserting .png file into bytea column References: <2BC18916DE4BF141AC1EFC55CE2CAE7D111B8C62@NAEANRFKXM01V.nadsusea.nads.navy.mil> In-Reply-To: <2BC18916DE4BF141AC1EFC55CE2CAE7D111B8C62@NAEANRFKXM01V.nadsusea.nads.navy.mil> Content-Type: multipart/alternative; boundary="------------050807060501080905070805" X-Pg-Spam-Score: -1.1 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org This is a multi-part message in MIME format. --------------050807060501080905070805 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 --------------050807060501080905070805 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit
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
--------------050807060501080905070805--