Re: Desirability of client-side expressions in psql?

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Desirability of client-side expressions in psql?
Date: 2018-07-08 07:28:37
Message-ID: alpine.DEB.2.21.1807071946470.21581@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello Stephen,

> [...] So, I tend to agree w/ Andrew that while this is a good topic to
> have on -hackers, it shouldn't be a CF entry. I wouldn't draw any
> conclusions from Andrew closing it out as "not appropriate for CF".

Sure. As I had no committer feedback on the discussion for 3 months, I
tried this as an ineffective way to get some. It did not work up to now.

>> As I have not received feedback from committers about the desirability of
>> the feature, I interpret that as "the feature is not desirable", and I will
>> not develop it, because of the probability that this would be time down the
>> drain.
>
> Personally, I'm definitely in favor of having a lot more flexibility and
> capability in psql, that's an area which I think we don't focus on
> nearly enough. Having to fight with bash or another language to make
> calls to psql to get things done is downright annoying.
>
> So, +1 from me on the overall idea.

Good, that is one committer opinion, an infinite improvement over the
previous status:-)

> The challenge here will almost certainly be in the details.

Yep. I'm fine with "your code is not good and creates problems so it is
rejected". I'm trying to avoid "your code was a loss from the start,
whatever you did, because we do not want such a feature".

> I do like the proposal you have of building out a common set of
> capabilities which are shared between psql and pgbench.

Good.

> The other big challenge here is figuring out how to distinguish between
> SQL which should be sent to the server and something which needs to be
> client-side processed.

The current great idea is to use backslash commands to define existing
variables:

psql> \let i 1 + 2 * 3
psql> SELECT :i ;
psql> \if :i >= 5
psql> ...
psql> \endif

> I've never liked the ':var' approach and it really sucks when you want
> to combine that variable with something else, but it's what we've got
> and therefore has history behind it.

Indeed. I do not think that changing this would make much sense.

> If you can find a way to improve on that without breaking existing code,
> that'd be fantastic. If not, definitely try to minimize the impact.

I was just planning to set existing :-variables with expressions, I have
no great other idea. Mixing languages is always a pain.

Thanks for your feedback.

--
Fabien.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2018-07-08 08:39:06 Re: [HACKERS] WIP Patch: Pgbench Serialization and deadlock errors
Previous Message Haribabu Kommi 2018-07-08 02:48:19 Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query