psql and query buffer mangling

Поиск
Список
Период
Сортировка
От Daniele Varrazzo
Тема psql and query buffer mangling
Дата
Msg-id BANLkTi=1o8wzcUZV0xYg5F-n_FmNRPCsbQ@mail.gmail.com
обсуждение исходный текст
Список pgsql-general
Hello,

I see psql performs some elaboration on the input query before storing
it in the query buffer: for instance variables are replaced:

    =# \set test 10
    =# select :test;
     ?column?
    ----------
           10
    (1 row)

    =# \p
    select 10;

and comments are stripped:

    duma=# select 1; -- comment
     ?column?
    ----------
            1
    (1 row)

    duma=# \p
    select 1;

Sometimes I use psql to test complex queries which are part of
programs, thus containing placeholders: roundtripping through the
editor via \e will lose the placeholders (as well as the comments)
making harder to test different values and finally to paste back the
query into the program.

Wouldn't be a better behaviour to store the unmodified input into the
query buffer and to perform the required query mangling downstream?

-- Daniele

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

Предыдущее
От: Iain Barnett
Дата:
Сообщение: Locale and UTF8 for template1 in 8.4.4
Следующее
От: Tom Lane
Дата:
Сообщение: Re: undead index