From c1a36cc2c67de45c4f6db6ecd2cc9102c5170ba2 Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Thu, 12 Sep 2024 18:46:04 +0200 Subject: Fix a few tests that no longer work in newer Postgres versions The WITH(OIDS=true) attribute for CREATE TABLE is no longer supported since version 12. So simply don't run the test for inserted-oid. I *think* this means the inserted-oid procedure is completely useless now, but I'm not 100% sure. The pg_type table has grown a "oid" column in 9.3 which comes before the "typename" column, which used to be the first. So the test is a bit too tightly coupled to the postgres system catalog. Move the test to where we create actual tables and use it on that, instead. --- tests/run.scm | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'tests/run.scm') diff --git a/tests/run.scm b/tests/run.scm index 21daa09..ff4c0d2 100644 --- a/tests/run.scm +++ b/tests/run.scm @@ -121,10 +121,6 @@ (exn postgresql bounds) (table-oid (query conn "SELECT typname FROM pg_type") 1)) - (test "Table column number for real table" - 0 - (table-column-index - (query conn "SELECT typname FROM pg_type") 0)) (test "Column format is text for normal data" 'text (column-format @@ -257,6 +253,10 @@ 1 (affected-rows (query conn "INSERT INTO foo (bar) VALUES (1);"))) + (test "Table column number for real table" + 0 + (table-column-index + (query conn "SELECT bar FROM foo") 0)) (query conn "COMMIT") (query conn "BEGIN") @@ -282,13 +282,15 @@ (query conn "INSERT INTO foo (bar) VALUES (1);"))) (query conn "COMMIT") - (query conn "BEGIN") - (query conn "CREATE TEMP TABLE foo ( bar integer ) WITH (OIDS=true) ON COMMIT DROP") - (test-assert "Inserted OID number on table with OID" - (number? - (inserted-oid - (query conn "INSERT INTO foo (bar) VALUES (1)")))) - (query conn "COMMIT") + ;; Since Postgres 12, WITH OIDS is not supported anymore + (when (< major-version 12) + (query conn "BEGIN") + (query conn "CREATE TEMP TABLE foo ( bar integer ) WITH (OIDS=true) ON COMMIT DROP") + (test-assert "Inserted OID number on table with OID" + (number? + (inserted-oid + (query conn "INSERT INTO foo (bar) VALUES (1)")))) + (query conn "COMMIT")) (test "regular parameters" "hi" -- cgit v1.2.3