Re: insert a text file into a variable in order to insert into a bytea column - Mailing list pgsql-sql

From Adrian Klaver
Subject Re: insert a text file into a variable in order to insert into a bytea column
Date
Msg-id 56AA9DD8.104@aklaver.com
Whole thread Raw
In response to Re: insert a text file into a variable in order to insert into a bytea column  (Arthur Lewis <arthur.lewis@hypermediasystems.com>)
List pgsql-sql
On 01/28/2016 02:36 PM, Arthur Lewis wrote:
> Hi David,
> Yes you're correct.  The problem is caused by the back-ticks (`)  Here is what I found in the docs about back-ticks
>
> "Within an argument, text that is enclosed in backquotes (`) is taken as a command line that is passed to the shell.
Theoutput of the command (with any trailing newline removed) replaces the backquoted text."
 

Huh, I missed that in reading the docs.

So:

test-# \set stext `cat test.txt`
test-# \echo :stext 

Test 

second line 

test-# \set stext `cat test.txt` '\n' 

test-# \echo :stext 

Test 

second line 


test-#

New lesson learned.

>
> Arthur Lewis
>



-- 
Adrian Klaver
adrian.klaver@aklaver.com



pgsql-sql by date:

Previous
From: Arthur Lewis
Date:
Subject: Re: insert a text file into a variable in order to insert into a bytea column
Next
From: Andreas Joseph Krogh
Date:
Subject: GROUP BY overlapping (tsrange) entries