Re: insert a text file into a variable in order to insert into a bytea column

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: insert a text file into a variable in order to insert into a bytea column
Дата
Msg-id 56AA9DD8.104@aklaver.com
обсуждение исходный текст
Ответ на Re: insert a text file into a variable in order to insert into a bytea column  (Arthur Lewis <arthur.lewis@hypermediasystems.com>)
Список 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 по дате отправления:

Предыдущее
От: Arthur Lewis
Дата:
Сообщение: Re: insert a text file into a variable in order to insert into a bytea column
Следующее
От: Andreas Joseph Krogh
Дата:
Сообщение: GROUP BY overlapping (tsrange) entries