From: | Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com> |
---|---|
To: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | psql and query buffer mangling |
Date: | 2011-05-06 15:12:01 |
Message-ID: | BANLkTi=1o8wzcUZV0xYg5F-n_FmNRPCsbQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2011-05-06 15:18:29 | Re: undead index |
Previous Message | Iain Barnett | 2011-05-06 15:11:52 | Locale and UTF8 for template1 in 8.4.4 |