Re: [despammed] Insert psql commands inside a script

Поиск
Список
Период
Сортировка
От Geoffrey
Тема Re: [despammed] Insert psql commands inside a script
Дата
Msg-id 426A3C74.8040309@3times25.net
обсуждение исходный текст
Ответ на Re: [despammed] Insert psql commands inside a script  (Andreas Kretschmer <akretschmer@despammed.com>)
Ответы Re: [despammed] Insert psql commands inside a script  (Michael Fuhr <mike@fuhr.org>)
Список pgsql-sql
Andreas Kretschmer wrote:
> am  21.04.2005, um 17:19:23 -0500 mailte Letnes, David G. folgendes:
> 
>>  I have used the psql -f /tmp/SelectCommands.sql before, but now I want
>>to put the sql statement right in the shell script.  I haven't had any
>>luck.  Is there a command I can use that will not point to a file for
>>the sql instructions but right on the same line.  I use very short psql
>>commands and would like to do it all with 1 file.
> 
> 
> echo "select bla from fasel" | psql -U <username> database
> 
> You can also use here documents, shell-variables and so on.

Or you can do the following:

psql database < sqlcode

where sqlcode contains your sql.

-- 
Until later, Geoffrey


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Sean Davis"
Дата:
Сообщение: Re: Looking for a way to sum integer arrays....
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: [despammed] Insert psql commands inside a script