summaryrefslogtreecommitdiff
path: root/contrib/dblink/sql
diff options
context:
space:
mode:
authorJoe Conway2010-02-03 23:02:39 +0000
committerJoe Conway2010-02-03 23:02:39 +0000
commitc3f8e037c0238a8132ed4245ced956a20db82635 (patch)
tree64b7ce4054cc0dc696445c43bdb7187338dae27e /contrib/dblink/sql
parent9d4269f087d94c868d4da72d14bdf89617b0246c (diff)
Check to ensure the number of primary key fields supplied does notREL7_3_STABLE
exceed the total number of non-dropped source table fields for dblink_build_sql_*(). Addresses bug report from Rushabh Lathia. Backpatch all the way to the 7.3 branch.
Diffstat (limited to 'contrib/dblink/sql')
-rw-r--r--contrib/dblink/sql/dblink.sql6
1 files changed, 6 insertions, 0 deletions
diff --git a/contrib/dblink/sql/dblink.sql b/contrib/dblink/sql/dblink.sql
index 4d534e50c1c..454e1dab11a 100644
--- a/contrib/dblink/sql/dblink.sql
+++ b/contrib/dblink/sql/dblink.sql
@@ -36,13 +36,19 @@ FROM dblink_get_pkey('foo');
-- build an insert statement based on a local tuple,
-- replacing the primary key values with new ones
SELECT dblink_build_sql_insert('foo','1 2',2,'{"0", "a"}','{"99", "xyz"}');
+-- too many pk fields, should fail
+SELECT dblink_build_sql_insert('foo','1 2 3 4',4,'{"0", "a", "{a0,b0,c0}"}','{"99", "xyz", "{za0,zb0,zc0}"}');
-- build an update statement based on a local tuple,
-- replacing the primary key values with new ones
SELECT dblink_build_sql_update('foo','1 2',2,'{"0", "a"}','{"99", "xyz"}');
+-- too many pk fields, should fail
+SELECT dblink_build_sql_update('foo','1 2 3 4',4,'{"0", "a", "{a0,b0,c0}"}','{"99", "xyz", "{za0,zb0,zc0}"}');
-- build a delete statement based on a local tuple,
SELECT dblink_build_sql_delete('foo','1 2',2,'{"0", "a"}');
+-- too many pk fields, should fail
+SELECT dblink_build_sql_delete('foo','1 2 3 4',4,'{"0", "a", "{a0,b0,c0}"}');
-- retest using a quoted and schema qualified table
CREATE SCHEMA "MySchema";