Hello! Here is a fix for the bug first described in: https://www.postgresql.org/message-id/flat/adf0452f-8c6b-7def-d35e-ab516c80088e%40inbox.ru
Reproduction:
1) On master with 'wal_level = logical' execute mascmd.sql attached.
2) On replica substitute the correct port in repcmd.sql and execute it.
3) On master execute command:
INSERT INTO rul_rule_set VALUES ('1', 'name','1','age','true');
Replica will crash with:
FailedAssertion("ActivePortal && ActivePortal->status == PORTAL_ACTIVE", File:
"pg_proc.c", Line: 1038, PID: 42894)
in infinite loop.
After applying this patch replica will give the correct error message instead
of assertion:
2022-08-21 17:08:39.935 MSK [143171] ERROR: relation "rul_rule_set" does not
exist at character 172
2022-08-21 17:08:39.935 MSK [143171] QUERY:
-- Last modified: 2022-08-21 17:08:39.930842+03
with parameters as (
<<--- skipped by me --- >>>
)
2022-08-21 17:08:39.935 MSK [143171] CONTEXT: SQL statement "create or replace
function public.rule_set_selector(
<<--- skipped by me --- >>>
SQL statement "call public.rebuild_rule_set_selector()"
PL/pgSQL function public.rul_rule_set_trg() line 4 at CALL
processing remote data for replication origin "pg_16401" during "INSERT"
for replication target relation "public.rul_rule_set" in transaction
741 finished at 0/17BE180
With best regards,
--
Anton A. Melnikov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
mascmd.sql
Description: application/sql
repcmd.sql
Description: application/sql
commit 585d0cd944d952f08f7649d02f1d6b6644e93611 Author: Peter Eisentraut <[email protected]> Date: Sat Aug 20 20:48:47 2022 +0200 Remove dummyret definition This hasn't been used in a while (last use removed by 50d22de932, and before that 84b6d5f359), and since we are now preferring inline functions over complex macros, it's unlikely to be needed again. Reviewed-by: Daniel Gustafsson <[email protected]> Discussion: https://www.postgresql.org/message-id/flat/7110ab37-8ddd-437f-905c-6aa6205c6185%40enterprisedb.com diff --git a/src/include/c.h b/src/include/c.h index 65e91a6b89..dfc366b026 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -333,16 +333,6 @@ _61,_62,_63, N, ...) \ (N) -/* - * dummyret is used to set return values in macros that use ?: to make - * assignments. gcc wants these to be void, other compilers like char - */ -#ifdef __GNUC__ /* GNU cc */ -#define dummyret void -#else -#define dummyret char -#endif - /* * Generic function pointer. This can be used in the rare cases where it's * necessary to cast a function pointer to a seemingly incompatible function
