1

I don't understand why these functions behave differently. The fact that they have a different arity shouldn't affect my ability to quote them.

janus@janus-ux305ca ~ % psql
psql (14.11 (Debian 14.11-1.pgdg110+1))
Type "help" for help.

janus=> select least(1,2); least


 1

(1 row)

janus=> select "least"(1,2); ERROR: function least(integer, integer) does not exist LINE 1: select "least"(1,2); ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. janus=> select "count"(1); count


 1

(1 row)

What is the correct terminology that explains the difference in behaviour?

Erwin Brandstetter
  • 185,527
  • 28
  • 463
  • 633

1 Answers1

2

LEAST (and GREATEST, and COALESCE, etc.) are not SQL functions, this is why they are listed in the "Conditional expressions" section of the manual. Subsequently, the SQL quoting rules do not apply to them; they're much like the other SQL keywords.

Figuring out why the Postgres developers chose to implement them in this manner, I'll leave as an excercie for the reader (or an opportunity for one of them to answer).

mustaccio
  • 28,207
  • 24
  • 60
  • 76