Converting pqsignal to void return

From: Paul Ramsey <pramsey(at)cleverelephant(dot)ca>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Subject: Converting pqsignal to void return
Date: 2025-01-22 15:57:52
Message-ID: 4E796D56-79B5-4447-9DA7-5428BC1A6B53@cleverelephant.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Nathan,

I just ran across this change when a bunch of CI’s I run barfed.

https://github.com/postgres/postgres/commit/d4a43b283751b23d32bbfa1ecc2cad2d16e3dde9

The problem we are having in extension land is that we often run functions in external libraries that take a long time to return, and we would like to ensure that PgSQL users can cancel their queries, even when control has passed into those functions.

The way we have done it, historically, has been to take the return value of pqsignal(SIGINT, extension_signint_handler) and remember it, and then, inside extension_signint_handler, call the pgsql handler once we have done our own business.

https://github.com/pramsey/pgsql-http/blob/master/http.c#L345

It is possible we have been Doing It Wrong all this time, and would love some pointers on the right way to do this.

Alternatively, if we have a valid use case, it would be nice to have the return value from pqsignal() back.

Thanks!

Paul

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2025-01-22 16:07:57 Re: RFC: Additional Directory for Extensions
Previous Message Nathan Bossart 2025-01-22 15:56:33 Re: Pre-allocating WAL files