diff --git a/src/test/regress/expected/publication.out b/src/test/regress/expected/publication.out index b55da39fde5..57e31e57ea7 100644 --- a/src/test/regress/expected/publication.out +++ b/src/test/regress/expected/publication.out @@ -1573,6 +1573,19 @@ CREATE TEMPORARY TABLE testpub_temptbl(a int); CREATE PUBLICATION testpub_fortemptbl FOR TABLE testpub_temptbl; ERROR: cannot add relation "testpub_temptbl" to publication DETAIL: This operation is not supported for temporary tables. +-- fail - temporary table in the EXCEPT clause; the temp schema number +-- depends on the backend, so it is redacted +DO $$ +DECLARE + detail text; +BEGIN + CREATE PUBLICATION testpub_excepttemptbl FOR ALL TABLES EXCEPT (TABLE testpub_temptbl); +EXCEPTION WHEN invalid_parameter_value THEN + GET STACKED DIAGNOSTICS detail = PG_EXCEPTION_DETAIL; + RAISE NOTICE '% (%)', + regexp_replace(SQLERRM, 'pg_temp_[0-9]*', 'pg_temp_REDACTED'), detail; +END $$; +NOTICE: cannot specify relation "pg_temp_REDACTED.testpub_temptbl" in the publication EXCEPT clause (This operation is not supported for temporary tables.) DROP TABLE testpub_temptbl; CREATE UNLOGGED TABLE testpub_unloggedtbl(a int); -- fail - unlogged table diff --git a/src/test/regress/sql/publication.sql b/src/test/regress/sql/publication.sql index e3dbb2bc57c..5ff58d20254 100644 --- a/src/test/regress/sql/publication.sql +++ b/src/test/regress/sql/publication.sql @@ -998,6 +998,18 @@ CREATE PUBLICATION testpub_fortbl FOR TABLE testpub_view; CREATE TEMPORARY TABLE testpub_temptbl(a int); -- fail - temporary table CREATE PUBLICATION testpub_fortemptbl FOR TABLE testpub_temptbl; +-- fail - temporary table in the EXCEPT clause; the temp schema number +-- depends on the backend, so it is redacted +DO $$ +DECLARE + detail text; +BEGIN + CREATE PUBLICATION testpub_excepttemptbl FOR ALL TABLES EXCEPT (TABLE testpub_temptbl); +EXCEPTION WHEN invalid_parameter_value THEN + GET STACKED DIAGNOSTICS detail = PG_EXCEPTION_DETAIL; + RAISE NOTICE '% (%)', + regexp_replace(SQLERRM, 'pg_temp_[0-9]*', 'pg_temp_REDACTED'), detail; +END $$; DROP TABLE testpub_temptbl; CREATE UNLOGGED TABLE testpub_unloggedtbl(a int);