public inbox for [email protected]
help / color / mirror / Atom feedFrom: Jeff Davis <[email protected]>
To: [email protected]
Subject: ALTER FOREIGN DATA WRAPPER can drop dependency on handler
Date: Wed, 18 Mar 2026 12:09:54 -0700
Message-ID: <[email protected]> (raw)
CREATE FUNCTION test_fdw_handler()
RETURNS fdw_handler
AS :'regresslib', 'test_fdw_handler'
LANGUAGE C;
CREATE FOREIGN DATA WRAPPER test_fdw HANDLER test_fdw_handler;
-- correctly raises dependency ERROR
DROP FUNCTION test_fdw_handler;
ALTER FOREIGN DATA WRAPPER test_fdw VALIDATOR postgresql_fdw_validator;
-- fails to raise dependency error ERROR
DROP FUNCTION test_fdw_handler;
Patch attached.
Note: I found this while investigating a related issue for the FDW
connection function, with patch here:
https://www.postgresql.org/message-id/[email protected]
I am keeping this patch separate for a clean backport.
Regards,
Jeff Davis
Attachments:
[text/x-patch] v1-0001-Fix-dependency-on-FDW-handler.patch (935B, 2-v1-0001-Fix-dependency-on-FDW-handler.patch)
download | inline diff:
From bf7685cbda2c885fcc6b9aecf11da5c8898db496 Mon Sep 17 00:00:00 2001
From: Jeff Davis <[email protected]>
Date: Wed, 18 Mar 2026 11:52:15 -0700
Subject: [PATCH v1] Fix dependency on FDW handler.
ALTER FOREIGN DATA WRAPPER could drop the dependency on the handler
function if it wasn't explicitly specified.
---
src/backend/commands/foreigncmds.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/backend/commands/foreigncmds.c b/src/backend/commands/foreigncmds.c
index 45681235782..0b31afd8a79 100644
--- a/src/backend/commands/foreigncmds.c
+++ b/src/backend/commands/foreigncmds.c
@@ -786,6 +786,11 @@ AlterForeignDataWrapper(ParseState *pstate, AlterFdwStmt *stmt)
ereport(WARNING,
(errmsg("changing the foreign-data wrapper handler can change behavior of existing foreign tables")));
}
+ else
+ {
+ /* handler unchanged */
+ fdwhandler = fdwForm->fdwhandler;
+ }
if (validator_given)
{
--
2.43.0
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]
Subject: Re: ALTER FOREIGN DATA WRAPPER can drop dependency on handler
In-Reply-To: <[email protected]>
* 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