summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2014-06-12 15:54:13 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2014-06-12 15:54:21 -0400
commite6f6db300fef2e53080209ae00f19408203e5686 (patch)
tree4b59b173d8d9e6b0fec8033d89df1007ad2cbf6f /src
parente3489847d08beaa4b9dc2a84011719f0b848f3e1 (diff)
Add regression test to prevent future breakage of legacy query in libpq.
Memorialize the expected output of the query that libpq has been using for many years to get the OIDs of large-object support functions. Although we really ought to change the way libpq does this, we must expect that this query will remain in use in the field for the foreseeable future, so until we're ready to break compatibility with old libpq versions we'd better check the results stay the same. See the recent lo_create() fiasco.
Diffstat (limited to 'src')
-rw-r--r--src/test/regress/expected/opr_sanity.out40
-rw-r--r--src/test/regress/sql/opr_sanity.sql24
2 files changed, 64 insertions, 0 deletions
diff --git a/src/test/regress/expected/opr_sanity.out b/src/test/regress/expected/opr_sanity.out
index 8c2443d6b3e..c8d8ffd7bac 100644
--- a/src/test/regress/expected/opr_sanity.out
+++ b/src/test/regress/expected/opr_sanity.out
@@ -638,6 +638,46 @@ uuid_gt(uuid,uuid)
uuid_ne(uuid,uuid)
-- restore normal output mode
\a\t
+-- List of functions used by libpq's fe-lobj.c
+--
+-- If the output of this query changes, you probably broke libpq.
+-- lo_initialize() assumes that there will be at most one match for
+-- each listed name.
+select proname, oid from pg_catalog.pg_proc
+where proname in (
+ 'lo_open',
+ 'lo_close',
+ 'lo_creat',
+ 'lo_create',
+ 'lo_unlink',
+ 'lo_lseek',
+ 'lo_lseek64',
+ 'lo_tell',
+ 'lo_tell64',
+ 'lo_truncate',
+ 'lo_truncate64',
+ 'loread',
+ 'lowrite')
+and pronamespace = (select oid from pg_catalog.pg_namespace
+ where nspname = 'pg_catalog')
+order by 1;
+ proname | oid
+---------------+------
+ lo_close | 953
+ lo_creat | 957
+ lo_create | 715
+ lo_lseek | 956
+ lo_lseek64 | 3170
+ lo_open | 952
+ lo_tell | 958
+ lo_tell64 | 3171
+ lo_truncate | 1004
+ lo_truncate64 | 3172
+ lo_unlink | 964
+ loread | 954
+ lowrite | 955
+(13 rows)
+
-- **************** pg_cast ****************
-- Catch bogus values in pg_cast columns (other than cases detected by
-- oidjoins test).
diff --git a/src/test/regress/sql/opr_sanity.sql b/src/test/regress/sql/opr_sanity.sql
index de26af0d5a8..213a66d4a31 100644
--- a/src/test/regress/sql/opr_sanity.sql
+++ b/src/test/regress/sql/opr_sanity.sql
@@ -317,6 +317,30 @@ ORDER BY 1;
-- restore normal output mode
\a\t
+-- List of functions used by libpq's fe-lobj.c
+--
+-- If the output of this query changes, you probably broke libpq.
+-- lo_initialize() assumes that there will be at most one match for
+-- each listed name.
+select proname, oid from pg_catalog.pg_proc
+where proname in (
+ 'lo_open',
+ 'lo_close',
+ 'lo_creat',
+ 'lo_create',
+ 'lo_unlink',
+ 'lo_lseek',
+ 'lo_lseek64',
+ 'lo_tell',
+ 'lo_tell64',
+ 'lo_truncate',
+ 'lo_truncate64',
+ 'loread',
+ 'lowrite')
+and pronamespace = (select oid from pg_catalog.pg_namespace
+ where nspname = 'pg_catalog')
+order by 1;
+
-- **************** pg_cast ****************