pgsql: Declare lead() and lag() using anycompatible not anyelement.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Declare lead() and lag() using anycompatible not anyelement.
Date: 2020-11-04 20:08:48
Message-ID: E1kaP5M-0005So-77@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Declare lead() and lag() using anycompatible not anyelement.

This allows use of a "default" expression that doesn't slavishly
match the data column's type. Formerly you got something like
"function lag(numeric, integer, integer) does not exist", which
is not just unhelpful but actively misleading.

The SQL spec suggests that the default should be coerced to the data
column's type, but this implementation instead chooses the common
supertype, which seems at least as reasonable.

(Note: I took the opportunity to run "make reformat-dat-files" on
pg_proc.dat, so this commit includes some cosmetic changes to
recently-added entries that aren't related to lead/lag.)

Vik Fearing

Discussion: https://postgr.es/m/77675130-89da-dab1-51dd-492c93dcf5d1@postgresfriends.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5c292e6b90433c760a3e15027646c7b94afd0cdd

Modified Files
--------------
doc/src/sgml/func.sgml | 16 ++++++++--------
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_proc.dat | 32 +++++++++++++++++---------------
src/test/regress/expected/window.out | 30 ++++++++++++++++++++++++++++++
src/test/regress/sql/window.sql | 2 ++
5 files changed, 58 insertions(+), 24 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2020-11-04 20:36:14 Re: pgsql: Get rid of the dedicated latch for signaling the startup process
Previous Message Tom Lane 2020-11-04 17:35:04 pgsql: Improve our ability to regurgitate SQL-syntax function calls.