Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2dd352d

Browse files
committed
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.
1 parent 154146d commit 2dd352d

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

src/test/regress/expected/opr_sanity.out

+40
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,46 @@ uuid_gt(uuid,uuid)
638638
uuid_ne(uuid,uuid)
639639
-- restore normal output mode
640640
\a\t
641+
-- List of functions used by libpq's fe-lobj.c
642+
--
643+
-- If the output of this query changes, you probably broke libpq.
644+
-- lo_initialize() assumes that there will be at most one match for
645+
-- each listed name.
646+
select proname, oid from pg_catalog.pg_proc
647+
where proname in (
648+
'lo_open',
649+
'lo_close',
650+
'lo_creat',
651+
'lo_create',
652+
'lo_unlink',
653+
'lo_lseek',
654+
'lo_lseek64',
655+
'lo_tell',
656+
'lo_tell64',
657+
'lo_truncate',
658+
'lo_truncate64',
659+
'loread',
660+
'lowrite')
661+
and pronamespace = (select oid from pg_catalog.pg_namespace
662+
where nspname = 'pg_catalog')
663+
order by 1;
664+
proname | oid
665+
---------------+------
666+
lo_close | 953
667+
lo_creat | 957
668+
lo_create | 715
669+
lo_lseek | 956
670+
lo_lseek64 | 3170
671+
lo_open | 952
672+
lo_tell | 958
673+
lo_tell64 | 3171
674+
lo_truncate | 1004
675+
lo_truncate64 | 3172
676+
lo_unlink | 964
677+
loread | 954
678+
lowrite | 955
679+
(13 rows)
680+
641681
-- **************** pg_cast ****************
642682
-- Catch bogus values in pg_cast columns (other than cases detected by
643683
-- oidjoins test).

src/test/regress/sql/opr_sanity.sql

+24
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,30 @@ ORDER BY 1;
317317
-- restore normal output mode
318318
\a\t
319319

320+
-- List of functions used by libpq's fe-lobj.c
321+
--
322+
-- If the output of this query changes, you probably broke libpq.
323+
-- lo_initialize() assumes that there will be at most one match for
324+
-- each listed name.
325+
select proname, oid from pg_catalog.pg_proc
326+
where proname in (
327+
'lo_open',
328+
'lo_close',
329+
'lo_creat',
330+
'lo_create',
331+
'lo_unlink',
332+
'lo_lseek',
333+
'lo_lseek64',
334+
'lo_tell',
335+
'lo_tell64',
336+
'lo_truncate',
337+
'lo_truncate64',
338+
'loread',
339+
'lowrite')
340+
and pronamespace = (select oid from pg_catalog.pg_namespace
341+
where nspname = 'pg_catalog')
342+
order by 1;
343+
320344

321345
-- **************** pg_cast ****************
322346

0 commit comments

Comments
 (0)