COALESCE could use some better examples

From: PG Doc comments form <noreply(at)postgresql(dot)org>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Cc: matthias01123(at)gmail(dot)com
Subject: COALESCE could use some better examples
Date: 2022-10-13 14:28:23
Message-ID: 166567130399.591812.10092275852150047596@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/15/functions-conditional.html
Description:

Regarding:
https://www.postgresql.org/docs/current/functions-conditional.html

I ran into a situation where COALESCE was used like this

```
SELECT * FROM table WHERE COALESCE(col_1, col_2, col_3) >= 5
```

and didn't understand how it worked, and the examples don't really help
because they only use COALESCE like

```
SELECT COALESCE(..)
```

I asked and answered a question on stackoverflow with a pretty good example
of this, you could consider adding to your page.

Thank you :))

Stackoverflow question link:
https://stackoverflow.com/questions/74057319/coalesce-in-postgresql-conditional-displaying-seemingly-undocumented-behavior

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Bruce Momjian 2022-10-13 19:34:50 Re: COALESCE could use some better examples
Previous Message Tom Lane 2022-10-13 00:11:23 Re: Section 9.7.3.2. Bracket Expressions should be rewritten