public inbox for [email protected]  
help / color / mirror / Atom feed
From: Kirill Reshke <[email protected]>
To: Roman Khapov <[email protected]>
Cc: Daniel Gustafsson <[email protected]>
Cc: [email protected]
Subject: Re: Additional message in pg_terminate_backend
Date: Sat, 20 Dec 2025 15:32:34 +0500
Message-ID: <CALdSSPhU526xXqjsb=BPO689+qFJQDeimWrhOv=ehzveQsZJgw@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>

On Sat, 20 Dec 2025 at 14:27, Roman Khapov <[email protected]> wrote:
>
>
> > On 17 Dec 2025, at 21:02, Daniel Gustafsson <[email protected]> wrote:
> >
> > Greenplum already has support for passing a message in the terminate command
> > doesnt it?  Or at least it used to have but perhaps it was ripped out, my
> > memory is getting a bit fuzzy.
> >
> > https://github.com/greenplum-db/gpdb-archive/commit/fa6c2d43d675aa05e2d9f797e3008f6fe075ee2c
> >
>
> Well, seems like I missed that patch..
>
> Anyway, now I need same functionality in PostgreSQL, and your patch seems interesting,
> especially in part where you keep messages in separated shmem region.
>
> So I adopted your patch, maybe in that form it can be useful for PostgreSQL?
>



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

I don't think we need to create a function with a name other than
`pg_terminate_backend`.  I also do not think we need
pg_terminate_backend_msg as a wrapper to another function - all of
this can be a single function, accepting different number of params,
exampli gratia "bt_index_check"

```
Datum
bt_index_check(PG_FUNCTION_ARGS)
{
Oid indrelid = PG_GETARG_OID(0);

...

if (PG_NARGS() >= 2)
args.heapallindexed = PG_GETARG_BOOL(1);
if (PG_NARGS() >= 3)
args.checkunique = PG_GETARG_BOOL(2);
....


PG_RETURN_VOID();
}

```

-- 
Best regards,
Kirill Reshke





view thread (8+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Additional message in pg_terminate_backend
  In-Reply-To: <CALdSSPhU526xXqjsb=BPO689+qFJQDeimWrhOv=ehzveQsZJgw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox