Re: using placeholders in psql

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: using placeholders in psql
Дата
Msg-id Pine.LNX.4.30.0105052323200.769-100000@peter.localdomain
обсуждение исходный текст
Ответ на using placeholders in psql  (Oleg Bartunov <oleg@sai.msu.su>)
Ответы Re: using placeholders in psql
Список pgsql-interfaces
Oleg Bartunov writes:

> just an idea to use placeholders (?) in psql.
> It would be useful for interactive work and debuging.
> We already have powerful features in psql but sometimes
> we need more. If user enter select string with placeholder,
> he may get prompt to input something for arg1, then for arg2...

You can simulate this:

$ cat test.sql
\echo -n 'Enter something: '
\set val1 `read && echo $REPLY`

\echo -n 'And something else: '
\set val2 `read && echo $REPLY`

select :val1, :val2;

$ psql -f test.sql
Enter something: 55<enter>
And something else: 77<enter>?column? | ?column?
----------+----------      55 |       77
(1 row)

Does this work for your application?

The question marks pose too much of an incompatibility problem.  The :var
notation was already much disputed, even though it's kind of standard.

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter



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

Предыдущее
От: Oleg Bartunov
Дата:
Сообщение: using placeholders in psql
Следующее
От: Oleg Bartunov
Дата:
Сообщение: Re: using placeholders in psql