mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Change the interpretation of the primary_key_attnums parameter of
dblink_build_sql_insert() and related functions. Now the column numbers are treated as logical not physical column numbers. This will provide saner behavior in the presence of dropped columns; furthermore, if we ever get around to allowing rearrangement of logical column ordering, the original definition would become nearly untenable from a usability standpoint. Per recent discussion of dblink's handling of dropped columns. Not back-patched for fear of breaking existing applications.
This commit is contained in:
@ -903,21 +903,21 @@ ALTER TABLE test_dropped
|
||||
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,
|
||||
SELECT dblink_build_sql_insert('test_dropped', '1', 1,
|
||||
ARRAY['1'::TEXT], ARRAY['2'::TEXT]);
|
||||
dblink_build_sql_insert
|
||||
---------------------------------------------------------------------------
|
||||
INSERT INTO test_dropped(id,col2b,col3,col4) VALUES('2','113','foo','42')
|
||||
(1 row)
|
||||
|
||||
SELECT dblink_build_sql_update('test_dropped', '2', 1,
|
||||
SELECT dblink_build_sql_update('test_dropped', '1', 1,
|
||||
ARRAY['1'::TEXT], ARRAY['2'::TEXT]);
|
||||
dblink_build_sql_update
|
||||
-------------------------------------------------------------------------------------------
|
||||
UPDATE test_dropped SET id = '2', col2b = '113', col3 = 'foo', col4 = '42' WHERE id = '2'
|
||||
(1 row)
|
||||
|
||||
SELECT dblink_build_sql_delete('test_dropped', '2', 1,
|
||||
SELECT dblink_build_sql_delete('test_dropped', '1', 1,
|
||||
ARRAY['2'::TEXT]);
|
||||
dblink_build_sql_delete
|
||||
-----------------------------------------
|
||||
|
Reference in New Issue
Block a user