agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Arthur Lewis <arthur.lewis@hypermediasystems.com>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: insert a text file into a variable in order to insert into a bytea column
Date: Thu, 28 Jan 2016 15:01:44 -0800
Message-ID: <56AA9DD8.104@aklaver.com> (raw)
In-Reply-To: <1374628469.7191030.1454020562643.JavaMail.root@hypermediasystems.com>
References: <1374628469.7191030.1454020562643.JavaMail.root@hypermediasystems.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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. The output 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


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



view thread (8+ messages)

Message-ID: <56AA9DD8.104@aklaver.com>
Permalink:  ../56AA9DD8.104@aklaver.com/
Also on:    postgresql.org/message-id/56AA9DD8.104@aklaver.com

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: adrian.klaver@aklaver.com, arthur.lewis@hypermediasystems.com, david.g.johnston@gmail.com
  Subject: Re: insert a text file into a variable in order to insert into a bytea column
  In-Reply-To: <56AA9DD8.104@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox