Hello Daniel,
>> SELECT some-boolean-expression AS okay \gset
>> \if :okay
>
> Yes, the question was whether we leave it as that for v10,
> or if it's worth a last-minute improvement for usability,
> assuming it's doable, similarly to what $subject does to backtick
> expansion for external evaluation.
My 0.02 € about server-side expressions: ISTM that there is nothing
obvious/easy to do to include these:
- how would it work, both with \set ... and \if ...?
- should it be just simple expressions or may it allow complex queries?
- how would error detection and handling work from a script?
- should it have some kind of continuation, as expressions are likely to be longer than a constant?
- how would they interact with possible client-side expressions?
(on this point, I think that client-side is NOT needed for "psql". It makes sense for "pgbench" in a benchmarking
contextwhere the client must interact with the server in some special meaningful way, but for simple scripting
theperformance requirement and logic is not the same, so server-side could be enough).
Basically quite a few questions which would not find an instantaneous
answer and associated patch.
However I agree with you that there may be minimal usability things to add
before 10, similar to Tom's backtick variable substitution.
Having some access to the client version as suggested by Pavel looks like
a good idea for the kind of script which may rely on conditionals...
Maybe other things, not sure what, though. Maybe other client settings
could be exported as variables, but the version looks like the main which
is currently missing.
Maybe a way to know what is the client current status? eg in transaction,
transaction has aborted, things like that?
--
Fabien.