Re: COALESCE doccumentation

2019-04-30 Thread Daniil Treshchin
Hi David. "You invented the “higher” concept"- False. Not me. That's Joe Celko p. 227 ISBIN 978-0-12-800761-7. That's the ultimate authority still living on this earth. "There is not a single character varying typed value in any of these examples" - False. You clearly didn't even look at the ex

Re: COALESCE doccumentation

2019-04-30 Thread Daniil Treshchin
"SQL is a strongly typed language"  - nobody argues with that, that's a common fact everybody knows. "so it is well within its right to require that a query be well-formed such that all inputs to functions (which COALESCE is in this context) are of the same type or raise a compile time error" -

Re: COALESCE doccumentation

2019-04-29 Thread Daniil Treshchin
Oh, I was just playing a little bit with it to make sure how it works with some nesting involved. SELECT COALESCE(NULL, '12', '3', 1.2, (SELECT (CASE WHEN profile_code = 'abc' THEN '2d' ELSE '2d' END) FROM profile LIMIT 1)); -- failSELECT COALESCE(NULL, '12', '3', 1.2, (SELECT (CASE WHEN profi

Re: COALESCE doccumentation

2019-04-29 Thread Daniil Treshchin
Hi Bruce, David. Comment: "Without further elaboration as to the shortcomings" I provided a clear description on why, but for some reason it was missed in this thread. Here it is: The COALESCE(, ..., ) scans the list of s from left to right, determines the highest data type inthe list and ret

Re: COALESCE doccumentation

2019-04-29 Thread Tom Lane
Bruce Momjian writes: > On Sat, Apr 27, 2019 at 08:26:57PM +, PG Doc comments form wrote: >> Try, for example. >> >> SELECT COALESCE(NULL, '12', 3, 1, 1); -- OK! >> SELECT COALESCE(NULL, '12.2', 3.2, '1', 1.1); -- OK! >> SELECT COALESCE(NULL, '1d2', 3, 1, 1); -- error >> SELECT COALESCE(NULL

Re: COALESCE doccumentation

2019-04-29 Thread Bruce Momjian
On Sat, Apr 27, 2019 at 08:26:57PM +, PG Doc comments form wrote: > The following documentation comment has been logged on the website: > > Page: https://www.postgresql.org/docs/11/functions-conditional.html > Description: > > The documentation says: > > "The COALESCE function returns the fi

COALESCE doccumentation

2019-04-27 Thread PG Doc comments form
The following documentation comment has been logged on the website: Page: https://www.postgresql.org/docs/11/functions-conditional.html Description: The documentation says: "The COALESCE function returns the first of its arguments that is not null. Null is returned only if all arguments are null