Deal with PostgreSQL 14 while processing pg_terminate_backend().
authorTatsuo Ishii <ishii@sraoss.co.jp>
Tue, 16 Nov 2021 00:45:31 +0000 (09:45 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Tue, 16 Nov 2021 00:48:37 +0000 (09:48 +0900)
Do not reject two arguments form of pg_terminate_backend() as
PostgreSQL 14 or after accept two arguments.

src/utils/pool_select_walker.c

index 29fd05a9387d7ba1eb4f2b04534c7b3c1ff13fbe..a2404644f95d4e4518bfe10f5a6b30c30d95ec70 100644 (file)
@@ -332,7 +332,9 @@ static bool function_call_walker(Node *node, void *context)
 
                        if (ctx->pg_terminate_backend_pid == 0 && strcmp("pg_terminate_backend", fname) == 0)
                        {
-                               if (list_length(fcall->args) == 1)
+                               /* PostgreSQL 14 or after accept two arguments. */
+                               if (list_length(fcall->args) == 1 ||
+                                       list_length(fcall->args) == 2)
                                {
                                        Node *arg = linitial(fcall->args);
                                        if (IsA(arg, A_Const) &&