Skip to content

Commit b5aff92

Browse files
committed
Fix recent accidental omission in pg_proc.dat
ed1a88d added support functions for the ntile(), percent_rank() and cume_dist() window functions but neglected to actually add these support functions to the pg_proc entry for the corresponding window function. Also, take this opportunity to add these window functions to one of the regression tests added in ed1a88d to give the support functions a little bit of exercise. If I'd done that in the first place then the omission would have been more obvious. Bump the catversion, again.
1 parent c6f21b2 commit b5aff92

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

src/include/catalog/catversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@
5757
*/
5858

5959
/* yyyymmddN */
60-
#define CATALOG_VERSION_NO 202212232
60+
#define CATALOG_VERSION_NO 202212241
6161

6262
#endif

src/include/catalog/pg_proc.dat

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10204,20 +10204,22 @@
1020410204
proname => 'window_dense_rank_support', prorettype => 'internal',
1020510205
proargtypes => 'internal', prosrc => 'window_dense_rank_support' },
1020610206
{ oid => '3103', descr => 'fractional rank within partition',
10207-
proname => 'percent_rank', prokind => 'w', proisstrict => 'f',
10208-
prorettype => 'float8', proargtypes => '', prosrc => 'window_percent_rank' },
10207+
proname => 'percent_rank', prosupport => 'window_percent_rank_support',
10208+
prokind => 'w', proisstrict => 'f', prorettype => 'float8',
10209+
proargtypes => '', prosrc => 'window_percent_rank' },
1020910210
{ oid => '9773', descr => 'planner support for percent_rank',
1021010211
proname => 'window_percent_rank_support', prorettype => 'internal',
1021110212
proargtypes => 'internal', prosrc => 'window_percent_rank_support' },
1021210213
{ oid => '3104', descr => 'fractional row number within partition',
10213-
proname => 'cume_dist', prokind => 'w', proisstrict => 'f',
10214-
prorettype => 'float8', proargtypes => '', prosrc => 'window_cume_dist' },
10214+
proname => 'cume_dist', prosupport => 'window_cume_dist_support',
10215+
prokind => 'w', proisstrict => 'f', prorettype => 'float8',
10216+
proargtypes => '', prosrc => 'window_cume_dist' },
1021510217
{ oid => '9774', descr => 'planner support for cume_dist',
1021610218
proname => 'window_cume_dist_support', prorettype => 'internal',
1021710219
proargtypes => 'internal', prosrc => 'window_cume_dist_support' },
1021810220
{ oid => '3105', descr => 'split rows into N groups',
10219-
proname => 'ntile', prokind => 'w', prorettype => 'int4',
10220-
proargtypes => 'int4', prosrc => 'window_ntile' },
10221+
proname => 'ntile', prosupport => 'window_ntile_support', prokind => 'w',
10222+
prorettype => 'int4', proargtypes => 'int4', prosrc => 'window_ntile' },
1022110223
{ oid => '9775', descr => 'planner support for ntile',
1022210224
proname => 'window_ntile_support', prorettype => 'internal',
1022310225
proargtypes => 'internal', prosrc => 'window_ntile_support' },

src/test/regress/expected/window.out

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3326,7 +3326,13 @@ SELECT
33263326
rank() OVER (PARTITION BY depname ORDER BY enroll_date ROWS BETWEEN
33273327
UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) rnk,
33283328
dense_rank() OVER (PARTITION BY depname ORDER BY enroll_date RANGE BETWEEN
3329-
CURRENT ROW AND CURRENT ROW) drnk
3329+
CURRENT ROW AND CURRENT ROW) drnk,
3330+
ntile(10) OVER (PARTITION BY depname ORDER BY enroll_date RANGE BETWEEN
3331+
CURRENT ROW AND UNBOUNDED FOLLOWING) nt,
3332+
percent_rank() OVER (PARTITION BY depname ORDER BY enroll_date ROWS BETWEEN
3333+
CURRENT ROW AND UNBOUNDED FOLLOWING) pr,
3334+
cume_dist() OVER (PARTITION BY depname ORDER BY enroll_date RANGE BETWEEN
3335+
CURRENT ROW AND UNBOUNDED FOLLOWING) cd
33303336
FROM empsalary;
33313337
QUERY PLAN
33323338
----------------------------------------

src/test/regress/sql/window.sql

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,13 @@ SELECT
987987
rank() OVER (PARTITION BY depname ORDER BY enroll_date ROWS BETWEEN
988988
UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) rnk,
989989
dense_rank() OVER (PARTITION BY depname ORDER BY enroll_date RANGE BETWEEN
990-
CURRENT ROW AND CURRENT ROW) drnk
990+
CURRENT ROW AND CURRENT ROW) drnk,
991+
ntile(10) OVER (PARTITION BY depname ORDER BY enroll_date RANGE BETWEEN
992+
CURRENT ROW AND UNBOUNDED FOLLOWING) nt,
993+
percent_rank() OVER (PARTITION BY depname ORDER BY enroll_date ROWS BETWEEN
994+
CURRENT ROW AND UNBOUNDED FOLLOWING) pr,
995+
cume_dist() OVER (PARTITION BY depname ORDER BY enroll_date RANGE BETWEEN
996+
CURRENT ROW AND UNBOUNDED FOLLOWING) cd
991997
FROM empsalary;
992998

993999
-- Ensure WindowFuncs which cannot support their WindowClause's frameOptions

0 commit comments

Comments
 (0)