On Thu, May 7, 2015 at 11:43 AM, Fabien COELHO <coe...@cri.ensmp.fr> wrote:

>
> Hello,
>
>     \set id = 1 + abs((:id * 1021) % (100000 * :scale))
>>>
>>> seems slightly better than:
>>>
>>>    \set id 1 + abs((:id * 1021) % (100000 * :scale))
>>>
>>
>> It is question :( - it break a consistency with psql
>>
>
> It actually "breaks" nothing as it is purely cosmectic:-)
>
>
​
​Would "colon-equal" be more acceptable - like in pl/pgsql?

Even if "=" becomes a valid operator I would have to think it is a binary
operator and so its position at the start of an expression would still be
unambiguous as to whether it is cosmetic or functional.
​


> More seriously, I'm not sure that having a apparent syntatic homogeneity
> between psql and pgbench should be a requirement, but that is a point worth
> raising.
>
> The syntax are not really the same anyway: for instance "\set" and "\set
> NAME" means something for psql but not for pgbench.
>
> Moreover the "\set [NAME [VALUE]]" syntax of psql does not allow an
> expression, so it stays quite readable as it is, a situation not comparable
> to pgbench with expressions.
>
>
​This seems logical though having never used pgbench or compared them in
this manner...

The idea of an actual symbol separating the variable and the expression
seems worthwhile to add even in the face of "inconsistency" - which itself
should possibly be improved by yet additional changes.

David J.
​

Reply via email to