mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Fix dblink_build_sql_insert() and related functions to handle dropped
columns correctly. In passing, get rid of some dead logic in the underlying get_sql_insert() etc functions --- there is no caller that will pass null value-arrays to them. Per bug report from Robert Voinea.
This commit is contained in:
@ -325,3 +325,29 @@ SELECT dblink_disconnect('myconn');
|
||||
-- close the named persistent connection again
|
||||
-- should get 'connection "myconn" not available' error
|
||||
SELECT dblink_disconnect('myconn');
|
||||
|
||||
-- test dropped columns in dblink_build_sql_insert, dblink_build_sql_update
|
||||
CREATE TEMP TABLE test_dropped
|
||||
(
|
||||
col1 INT NOT NULL DEFAULT 111,
|
||||
id SERIAL PRIMARY KEY,
|
||||
col2 INT NOT NULL DEFAULT 112,
|
||||
col2b INT NOT NULL DEFAULT 113
|
||||
);
|
||||
|
||||
INSERT INTO test_dropped VALUES(default);
|
||||
|
||||
ALTER TABLE test_dropped
|
||||
DROP COLUMN col1,
|
||||
DROP COLUMN col2,
|
||||
ADD COLUMN col3 VARCHAR(10) NOT NULL DEFAULT 'foo',
|
||||
ADD COLUMN col4 INT NOT NULL DEFAULT 42;
|
||||
|
||||
SELECT dblink_build_sql_insert('test_dropped', '2', 1,
|
||||
ARRAY['1'::TEXT], ARRAY['2'::TEXT]);
|
||||
|
||||
SELECT dblink_build_sql_update('test_dropped', '2', 1,
|
||||
ARRAY['1'::TEXT], ARRAY['2'::TEXT]);
|
||||
|
||||
SELECT dblink_build_sql_delete('test_dropped', '2', 1,
|
||||
ARRAY['2'::TEXT]);
|
||||
|
Reference in New Issue
Block a user