proposal: using PQexecParams in psql (using variables as real params)

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема proposal: using PQexecParams in psql (using variables as real params)
Дата
Msg-id 162867790911151401u605fd4b4v6e0a2db42876f2eb@mail.gmail.com
обсуждение исходный текст
Ответы Re: proposal: using PQexecParams in psql (using variables as real params)
Список pgsql-hackers
Hello

I propose to add possibility to use psql variables as real query
parameters. The goal of this proposal is simplification of creating
psql based commands. Current using of psql variables based on
substitution has large area of using, but has some risks. a) there are
possible sql injection, b) we have to have to do some special (not too
much readable quoting) - see Bruce's book, psql chapter.

I checked, so this doesn't need much work. Attachment contains a prototype.

[pavel@nemesis ~]$ echo "select upper(:message)" | psql -r -v
message="Pavel's cat" postgres
    upper
─────────────
 PAVEL'S CAT
(1 row)

[pavel@nemesis ~]$ psql -v message="Pavel's cat" postgres
psql (8.5devel)
Type "help" for help.

postgres=# \pexec
Separately passing parameters is on.
postgres=# select upper(:message);
    upper
─────────────
 PAVEL'S CAT
(1 row)

This small feature simplify integration psql to shell environment.

comments, notes??

Regards
Pavel Stehule

Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: patch - Report the schema along table name in a referential failure error message
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [COMMITTERS] pgsql: /home/peter/commit-msg