From: | Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, Daniel Verite <daniel(at)manitou-mail(dot)org>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Greg Stark <stark(at)mit(dot)edu>, Erik Rijkers <er(at)xs4all(dot)nl>, Robert Haas <robertmhaas(at)gmail(dot)com>, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, PostgreSQL <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: \if, \elseif, \else, \endif (was Re: PSQL commands: \quit_if, \quit_unless) |
Date: | 2017-03-30 07:20:39 |
Message-ID: | alpine.DEB.2.20.1703300843020.2076@lancre |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello Tom,
>> Patch applies cleanly. Make check ok. Feature still works!
Idem for v30.
> [...] Aside from cosmetic changes, I've made it behave reasonably for
> cases where \if is used on portions of a query, for instance
>
> SELECT
> \if :something
> var1
> \else
> var2
> \endif
> FROM table;
This is commendable, but I would not have bothered, although it is more
cpp-like with it.
A small issue I see is that I was planning to add such an if syntax to
pgbench (well, at least if I succeed in getting boolean expressions and
setting variables, which is just a maybe), but this kind of if in the
middle of expression does not make much sense for a pgbench script where
"if" must be evaluated at execution time, not parse time.
> which as I mentioned a long time ago is something that people will
> certainly expect to work.
I would not have expected it to work, but indeed other people could.
Sometimes I try something with pg and it does not work as I hoped. That is
life.
> I also cleaned up a lot of corner-case discrepancies between how much
> text is consumed in active-branch and inactive-branch cases (OT_FILEPIPE
> is a particularly nasty case in that regard :-()
Indeed.
> I plan to read this over again tomorrow and then push it, if there are
> not objections/corrections.
My small objection is that an eventual if in pgbench, with a separate
parsing and execution, will not work in the middle of queries as this one.
Do you think that such a discrepancy would be admissible.
--
Fabien.
From | Date | Subject | |
---|---|---|---|
Next Message | Craig Ringer | 2017-03-30 08:07:05 | Re: Logical decoding on standby |
Previous Message | Ideriha, Takeshi | 2017-03-30 07:11:55 | Re: [WIP] RE: DECLARE STATEMENT setting up a connection in ECPG |