From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | proposal: using PQexecParams in psql (using variables as real params) |
Date: | 2009-11-15 22:01:55 |
Message-ID: | 162867790911151401u605fd4b4v6e0a2db42876f2eb@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)nemesis ~]$ echo "select upper(:message)" | psql -r -v
message="Pavel's cat" postgres
upper
─────────────
PAVEL'S CAT
(1 row)
[pavel(at)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
Attachment | Content-Type | Size |
---|---|---|
parametrisedexec.diff | text/x-patch | 4.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2009-11-15 22:09:55 | Re: pgsql: /home/peter/commit-msg |
Previous Message | Tom Lane | 2009-11-15 21:55:38 | Re: patch - Report the schema along table name in a referential failure error message |