Security Definer functions no longer works in PG14+ - Mailing list pgsql-bugs

From Jobin Augustine
Subject Security Definer functions no longer works in PG14+
Date
Msg-id CANaTPsphRF+7k+YANMv8goGu3oQLY9XtACpkec8Ju=mr59GHGA@mail.gmail.com
Whole thread Raw
Responses Re: Security Definer functions no longer works in PG14+
List pgsql-bugs
Hello Community and Hackers,

A function like:

CREATE OR REPLACE  FUNCTION fn_sql_refresh() RETURNS void AS $$
    ALTER SUBSCRIPTION sub REFRESH PUBLICATION;
$$ LANGUAGE SQL SECURITY DEFINER;

Works with PostgreSQL 13 and older versions.
But gives error on PostgreSQL 14 as follows:

postgres=> select fn_sql_refresh();
ERROR:  ALTER SUBSCRIPTION ... REFRESH cannot be executed from a function
CONTEXT:  SQL function "fn_sql_refresh" statement 1


But it is hurting good operational use cases of logical replication.

Regards,
Jobin.

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #17474: Segmentation fault from INSERT ( JumbleExpr )
Next
From: Jan Katins
Date:
Subject: Re: Security Definer functions no longer works in PG14+