ALTER DATABASE RESET with unexistent guc doesn't report an error

Vitaly Davydov <v.davydov@postgrespro.ru>

From: "Vitaly Davydov" <v.davydov@postgrespro.ru>
To: "pgsql-hackers" <pgsql-hackers@postgresql.org>
Date: 2025-09-11T08:35:36Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Reject "ALTER DATABASE/USER ... RESET foo" with invalid GUC name.

Attachments

Dear Hackers,

I've found that ALTER DATABASE RESET with an unexistent guc does nothing without
error reporting.

ALTER DATABASE SET reports an error if guc doesn't exist:

> alter database mydb set myparam to 10;
ERROR:  unrecognized configuration parameter "myparam"

ALTER DATABASE RESET doesn't report an error at all:

> alter database mydb reset myparam;
ALTER DATABASE

I think it is a wrong behaviour. I believe, ALTER DATABASE RESET should report
an error in this case. I've also think that ALTER DATABASE RESET TABLESPACE does
nothing without any error reporting. I've prepared a simple patch to handle this
case (master branch). It adds a check for guc existence with error reporting.

With best regards,
Vitaly