mirror of
				https://github.com/postgres/postgres.git
				synced 2025-10-31 10:30:33 +03:00 
			
		
		
		
	Also improve related error message as it contributed to the confusion. Discussion: CAB7nPqQrqFzjqCjxu4GZzTrD9kpj6HMn9G5aOOMwt1WZ8NfqeA@mail.gmail.com, CAB7nPqQXc_+g95zWnqaa=mVQ4d3BVRs6T41frcEYi2ocUrR3+A@mail.gmail.com Per discussion between Michael Paquier, Robert Haas and Andres Freund Backpatch to 9.4 where logical decoding was introduced.
		
			
				
	
	
		
			36 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| -- predictability
 | |
| SET synchronous_commit = on;
 | |
| SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot', 'test_decoding');
 | |
|  ?column? 
 | |
| ----------
 | |
|  init
 | |
| (1 row)
 | |
| 
 | |
| -- succeeds, textual plugin, textual consumer
 | |
| SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'force-binary', '0');
 | |
|  data 
 | |
| ------
 | |
| (0 rows)
 | |
| 
 | |
| -- fails, binary plugin, textual consumer
 | |
| SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'force-binary', '1');
 | |
| ERROR:  logical decoding output plugin "test_decoding" produces binary output, but "pg_logical_slot_get_changes(name,pg_lsn,integer,text[])" expects textual data
 | |
| -- succeeds, textual plugin, binary consumer
 | |
| SELECT data FROM pg_logical_slot_get_binary_changes('regression_slot', NULL, NULL, 'force-binary', '0');
 | |
|  data 
 | |
| ------
 | |
| (0 rows)
 | |
| 
 | |
| -- succeeds, binary plugin, binary consumer
 | |
| SELECT data FROM pg_logical_slot_get_binary_changes('regression_slot', NULL, NULL, 'force-binary', '1');
 | |
|  data 
 | |
| ------
 | |
| (0 rows)
 | |
| 
 | |
| SELECT 'init' FROM pg_drop_replication_slot('regression_slot');
 | |
|  ?column? 
 | |
| ----------
 | |
|  init
 | |
| (1 row)
 | |
| 
 |