mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Allow publications with schema and table of the same schema.
We previously thought that allowing such cases can confuse users when they specify DROP TABLES IN SCHEMA but that doesn't seem to be the case based on discussion. This helps to uplift the restriction during ALTER TABLE ... SET SCHEMA which used to ensure that we couldn't end up with a publication having both a schema and the same schema's table. To allow this, we need to forbid having any schema on a publication if column lists on a table are specified (and vice versa). This is because otherwise we still need a restriction during ALTER TABLE ... SET SCHEMA to forbid cases where it could lead to a publication having both a schema and the same schema's table with column list. Based on suggestions by Peter Eisentraut. Author: Hou Zhijie and Vignesh C Reviewed-By: Peter Smith, Amit Kapila Backpatch-through: 15, where it was introduced Discussion: https://postgr.es/m/2729c9e2-9aac-8cda-f2f4-34f2bcc18f4e@enterprisedb.com
This commit is contained in:
		@@ -3031,7 +3031,8 @@ create table alter1.t1 (a int);
 | 
			
		||||
set client_min_messages = 'ERROR';
 | 
			
		||||
create publication pub1 for table alter1.t1, tables in schema alter2;
 | 
			
		||||
reset client_min_messages;
 | 
			
		||||
alter table alter1.t1 set schema alter2; -- should fail
 | 
			
		||||
alter table alter1.t1 set schema alter2;
 | 
			
		||||
\d+ alter2.t1
 | 
			
		||||
drop publication pub1;
 | 
			
		||||
drop schema alter1 cascade;
 | 
			
		||||
drop schema alter2 cascade;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user