Support FETCH FIRST WITH TIES
authorAlvaro Herrera
Tue, 7 Apr 2020 20:22:13 +0000 (16:22 -0400)
committerAlvaro Herrera
Tue, 7 Apr 2020 20:22:13 +0000 (16:22 -0400)
commit357889eb17bb9c9336c4f324ceb1651da616fe57
treeef30422c7a6ebc2844492bd045ffbfeb30e54516
parent26a944cf29ba67bb49f42656dd2be98fe2485f5f
Support FETCH FIRST WITH TIES

WITH TIES is an option to the FETCH FIRST N ROWS clause (the SQL
standard's spelling of LIMIT), where you additionally get rows that
compare equal to the last of those N rows by the columns in the
mandatory ORDER BY clause.

There was a proposal by Andrew Gierth to implement this functionality in
a more powerful way that would yield more features, but the other patch
had not been finished at this time, so we decided to use this one for
now in the spirit of incremental development.

Author: Surafel Temesgen 
Reviewed-by: Álvaro Herrera
Reviewed-by: Tomas Vondra
Discussion: https://postgr.es/m/CALAY4q9ky7rD_A4vf=FVQvCGngm3LOes-ky0J6euMrg=_Se+ag@mail.gmail.com
Discussion: https://postgr.es/m/[email protected]
25 files changed:
doc/src/sgml/ref/select.sgml
src/backend/catalog/sql_features.txt
src/backend/executor/nodeLimit.c
src/backend/nodes/copyfuncs.c
src/backend/nodes/equalfuncs.c
src/backend/nodes/outfuncs.c
src/backend/nodes/readfuncs.c
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/plan/planner.c
src/backend/optimizer/util/pathnode.c
src/backend/parser/analyze.c
src/backend/parser/gram.y
src/backend/parser/parse_clause.c
src/backend/utils/adt/ruleutils.c
src/include/catalog/catversion.h
src/include/nodes/execnodes.h
src/include/nodes/nodes.h
src/include/nodes/parsenodes.h
src/include/nodes/pathnodes.h
src/include/nodes/plannodes.h
src/include/optimizer/pathnode.h
src/include/optimizer/planmain.h
src/include/parser/parse_clause.h
src/test/regress/expected/limit.out
src/test/regress/sql/limit.sql