Re: proposal - assign result of query to psql variable
Pavel Stehule <pavel.stehule@gmail.com>
From: Pavel Stehule <pavel.stehule@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Shigeru Hanada <shigeru.hanada@gmail.com>, Andrew Dunstan <andrew@dunslane.net>, Phil Sorber <phil@omniti.com>, Erik Rijkers <er@xs4all.nl>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2013-02-03T18:22:17Z
Lists: pgsql-hackers
2013/2/2 Tom Lane <tgl@sss.pgh.pa.us>: > Shigeru Hanada <shigeru.hanada@gmail.com> writes: >> On Sat, Feb 2, 2013 at 7:30 PM, Pavel Stehule <pavel.stehule@gmail.com> wrote: >>> possible variants >>> >>> a) don't store NULL values - and remove existing variable when NULL >>> be assigned - it is probably best, but should be confusing for users >>> b) implement flag IS NULL - for variables >>> c) use nullPrint >>> d) use empty String > >> +1 for a). If users want to determine whether the result was NULL, or >> want to use substitute string for NULL result, they can use coalesce >> in SELECT clause. Anyway the feature should be documented clearly. > > Yeah, I was considering that one too. Let's do it that way. > > regards, tom lane possible simple enhancing of this behave (for 9.4). now missing variables is replaced by variable's name. We can implement some pset option - some like define what do with missing variable \pset missing_variable (use_name | use_null | error ) when this option will be active, then missing variable will be replaced by NULL. With this feature sequences of SQL statements joined by some variables can work. SELECT NULL as myvar \gset \pset missing_variable use_null SELECT :'myvar' IS NULL; ideas, opinions ? Regards Pavel
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix oversight in new code for printing rangetable aliases.
- 8b728e5c6e0c 9.3.0 cited