Re: psql: Is it possible to run a query from a *sql file?
От | Tom Lane |
---|---|
Тема | Re: psql: Is it possible to run a query from a *sql file? |
Дата | |
Msg-id | 25274.1114968269@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | psql: Is it possible to run a query from a *sql file? (Ennio-Sr <nasr.laili@tin.it>) |
Ответы |
Re: psql: Is it possible to run a query from a *sql file?
Re: psql: Is it possible to run a query from a *sql file? |
Список | pgsql-novice |
Ennio-Sr <nasr.laili@tin.it> writes: > 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]%' Perhaps you want something like regression=# \echo prompt prompt regression=# \set foo `read val; echo "'$val'"` qwerty regression=# select :foo; ?column? ---------- qwerty (1 row) although on the whole I think you'd be better off turning this around: write it as a shell script and invoke psql for individual steps, rather than the other way round. It's hard to envision a script that needs user interaction and won't shortly thereafter need control structures etc. regards, tom lane
В списке pgsql-novice по дате отправления: