psql: Is it possible to run a query from a *sql file?

Поиск
Список
Период
Сортировка
От Ennio-Sr
Тема psql: Is it possible to run a query from a *sql file?
Дата
Msg-id 20050501163203.GA2497@deby.ei.hnet
обсуждение исходный текст
Ответы Re: psql: Is it possible to run a query from a *sql file?
Список pgsql-novice
[Running PG 7.4.7-5 on GNU-Linux Debian Sarge]

Hi all,
I'm wondering if it is possible to run a query from a .sql file, so as
to automate certain searches from console.
I've been unsuccessfully trying something like this simple one:

------------
\! echo "insert key: ";read key; export $key;
SELECT autore, titolo, editore FROM bibl WHERE autore like '%[$key]%'
------------

Most likely the answer is 'no', as psql is an 'interactive'
application.
There seems to be no communication between the shell (where you digit
the key) and psql: the key vanishes somewhere ... ;(

Regards,
    Ennio

BTW: Somebody knows where does pgaccess store its queries?

--
[Perche' usare Win$ozz (dico io) se ..."anche uno sciocco sa farlo.   \\?//
 Fa' qualche cosa di cui non sei capace!"  (diceva Henry Miller) ]    (°|°)
[Why use Win$ozz (I say) if ... "even a fool can do that.              )=(
 Do something you aren't good at!" (as Henry Miller used to say) ]

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

Предыдущее
От: tövis
Дата:
Сообщение: CONSTRAINT ... FOREIGN KEY
Следующее
От: Tom Lane
Дата:
Сообщение: Re: psql: Is it possible to run a query from a *sql file?