Fix recent accidental omission in pg_proc.dat
authorDavid Rowley <drowley@postgresql.org>
Sat, 24 Dec 2022 00:18:35 +0000 (13:18 +1300)
committerDavid Rowley <drowley@postgresql.org>
Sat, 24 Dec 2022 00:18:35 +0000 (13:18 +1300)
ed1a88dda 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 ed1a88dda 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.

src/include/catalog/catversion.h
src/include/catalog/pg_proc.dat
src/test/regress/expected/window.out
src/test/regress/sql/window.sql

index 1adf1403c89408796b3e6a954723c2626dc41921..e9206ff737923569b87c3eecefde7f2ae1fcf18c 100644 (file)
@@ -57,6 +57,6 @@
  */
 
 /*                         yyyymmddN */
-#define CATALOG_VERSION_NO 202212232
+#define CATALOG_VERSION_NO 202212241
 
 #endif
index 88bd472ecdb37c4e2da62f8d9cd3950b80868285..7056c953710f54f07bdaf9b36f8e7cbcef201420 100644 (file)
   proname => 'window_dense_rank_support', prorettype => 'internal',
   proargtypes => 'internal', prosrc => 'window_dense_rank_support' },
 { oid => '3103', descr => 'fractional rank within partition',
-  proname => 'percent_rank', prokind => 'w', proisstrict => 'f',
-  prorettype => 'float8', proargtypes => '', prosrc => 'window_percent_rank' },
+  proname => 'percent_rank', prosupport => 'window_percent_rank_support',
+  prokind => 'w', proisstrict => 'f', prorettype => 'float8',
+  proargtypes => '', prosrc => 'window_percent_rank' },
 { oid => '9773', descr => 'planner support for percent_rank',
   proname => 'window_percent_rank_support', prorettype => 'internal',
   proargtypes => 'internal', prosrc => 'window_percent_rank_support' },
 { oid => '3104', descr => 'fractional row number within partition',
-  proname => 'cume_dist', prokind => 'w', proisstrict => 'f',
-  prorettype => 'float8', proargtypes => '', prosrc => 'window_cume_dist' },
+  proname => 'cume_dist', prosupport => 'window_cume_dist_support',
+  prokind => 'w', proisstrict => 'f', prorettype => 'float8',
+  proargtypes => '', prosrc => 'window_cume_dist' },
 { oid => '9774', descr => 'planner support for cume_dist',
   proname => 'window_cume_dist_support', prorettype => 'internal',
   proargtypes => 'internal', prosrc => 'window_cume_dist_support' },
 { oid => '3105', descr => 'split rows into N groups',
-  proname => 'ntile', prokind => 'w', prorettype => 'int4',
-  proargtypes => 'int4', prosrc => 'window_ntile' },
+  proname => 'ntile', prosupport => 'window_ntile_support', prokind => 'w',
+  prorettype => 'int4', proargtypes => 'int4', prosrc => 'window_ntile' },
 { oid => '9775', descr => 'planner support for ntile',
   proname => 'window_ntile_support', prorettype => 'internal',
   proargtypes => 'internal', prosrc => 'window_ntile_support' },
index 776861808bc4fa665451a64a2fdbe6b5141cad60..5505e9a2dac26f172ac97962036bcbe360e9fed1 100644 (file)
@@ -3326,7 +3326,13 @@ SELECT
     rank() OVER (PARTITION BY depname ORDER BY enroll_date ROWS BETWEEN
                  UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) rnk,
     dense_rank() OVER (PARTITION BY depname ORDER BY enroll_date RANGE BETWEEN
-                       CURRENT ROW AND CURRENT ROW) drnk
+                       CURRENT ROW AND CURRENT ROW) drnk,
+    ntile(10) OVER (PARTITION BY depname ORDER BY enroll_date RANGE BETWEEN
+                    CURRENT ROW AND UNBOUNDED FOLLOWING) nt,
+    percent_rank() OVER (PARTITION BY depname ORDER BY enroll_date ROWS BETWEEN
+                         CURRENT ROW AND UNBOUNDED FOLLOWING) pr,
+    cume_dist() OVER (PARTITION BY depname ORDER BY enroll_date RANGE BETWEEN
+                      CURRENT ROW AND UNBOUNDED FOLLOWING) cd
 FROM empsalary;
                QUERY PLAN               
 ----------------------------------------
index deaf2217a6377282599dfdd6b07211d9ea5b8968..10f450fee4723779b04915794ea649d7afb7524d 100644 (file)
@@ -987,7 +987,13 @@ SELECT
     rank() OVER (PARTITION BY depname ORDER BY enroll_date ROWS BETWEEN
                  UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) rnk,
     dense_rank() OVER (PARTITION BY depname ORDER BY enroll_date RANGE BETWEEN
-                       CURRENT ROW AND CURRENT ROW) drnk
+                       CURRENT ROW AND CURRENT ROW) drnk,
+    ntile(10) OVER (PARTITION BY depname ORDER BY enroll_date RANGE BETWEEN
+                    CURRENT ROW AND UNBOUNDED FOLLOWING) nt,
+    percent_rank() OVER (PARTITION BY depname ORDER BY enroll_date ROWS BETWEEN
+                         CURRENT ROW AND UNBOUNDED FOLLOWING) pr,
+    cume_dist() OVER (PARTITION BY depname ORDER BY enroll_date RANGE BETWEEN
+                      CURRENT ROW AND UNBOUNDED FOLLOWING) cd
 FROM empsalary;
 
 -- Ensure WindowFuncs which cannot support their WindowClause's frameOptions