Re: Additional message in pg_terminate_backend

Поиск
Список
Период
Сортировка
От Jim Jones
Тема Re: Additional message in pg_terminate_backend
Дата
Msg-id 76e0edf2-4be3-458a-86e4-35b9dd836f31@uni-muenster.de
обсуждение исходный текст
Ответ на Re: Additional message in pg_terminate_backend  (Roman Khapov <rkhapov@yandex-team.ru>)
Список pgsql-hackers
Hi Roman

On 03/02/2026 13:28, Roman Khapov wrote:
> Thanks for another round on review, updated the patch according to comments.
> 
> Also, fix `make check` by updating pg_proc.data with new functions,
> similar to uuid7 way: defining _msg versions of the functions


Why did you decide to revert the pg_proc.dat and system_functions.sql
changes from v3? In v3 I thought that adding a msg DEFAULT '' to the
corresponding function in system_functions.sql ...

--- a/src/backend/catalog/system_functions.sql
+++ b/src/backend/catalog/system_functions.sql
@@ -400,7 +400,12 @@ CREATE OR REPLACE FUNCTION
   PARALLEL SAFE;

 CREATE OR REPLACE FUNCTION
-  pg_terminate_backend(pid integer, timeout int8 DEFAULT 0)
+  pg_cancel_backend(pid integer, msg text DEFAULT '')
+  RETURNS boolean STRICT VOLATILE LANGUAGE INTERNAL AS 'pg_cancel_backend'
+  PARALLEL SAFE;
+
+CREATE OR REPLACE FUNCTION
+  pg_terminate_backend(pid integer, timeout int8 DEFAULT 0, msg text
DEFAULT '')
   RETURNS boolean STRICT VOLATILE LANGUAGE INTERNAL AS
'pg_terminate_backend'
   PARALLEL SAFE;

... and updating pg_proc.dat accordingly would do the trick

diff --git a/src/include/catalog/pg_proc.dat
b/src/include/catalog/pg_proc.dat
index 5e5e33f64f..47aa30d716 100644
--- a/src/include/catalog/pg_proc.dat
+++ b/src/include/catalog/pg_proc.dat
@@ -6724,10 +6724,11 @@

 { oid => '2171', descr => 'cancel a server process\' current query',
   proname => 'pg_cancel_backend', provolatile => 'v', prorettype => 'bool',
-  proargtypes => 'int4', prosrc => 'pg_cancel_backend' },
+  proargtypes => 'int4 text', proargnames => '{pid,msg}',
+  prosrc => 'pg_cancel_backend' },
 { oid => '2096', descr => 'terminate a server process',
   proname => 'pg_terminate_backend', provolatile => 'v', prorettype =>
'bool',
-  proargtypes => 'int4 int8', proargnames => '{pid,timeout}',
+  proargtypes => 'int4 int8 text', proargnames => '{pid,timeout,msg}',
   prosrc => 'pg_terminate_backend' },
 { oid => '2172', descr => 'prepare for taking an online backup',
   proname => 'pg_backup_start', provolatile => 'v', proparallel => 'r',


My rationale is based on the header in system_function.sql:

...
 * src/backend/catalog/system_functions.sql
 *
 * This file redefines certain built-in functions that are impractical
 * to fully define in pg_proc.dat.  In most cases that's because they use
 * SQL-standard function bodies and/or default expressions...


Am I missing something?

Thanks

Best, Jim




В списке pgsql-hackers по дате отправления: