Skip to content

Commit 55f3d10

Browse files
committed
Remove unreferenced pg_opfamily entry.
The entry with OID 4035, for GIST jsonb_ops, is unused; apparently it was added in preparation for index support that never materialized. Remove it, and add a regression test case to detect future mistakes of the same kind. Discussion: https://postgr.es/m/17188.1541379745@sss.pgh.pa.us
1 parent 1eaeb02 commit 55f3d10

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

src/include/catalog/catversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/* yyyymmddN */
56-
#define CATALOG_VERSION_NO 201811012
56+
#define CATALOG_VERSION_NO 201811051
5757

5858
#endif

src/include/catalog/pg_opfamily.dat

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,6 @@
172172
opfmethod => 'btree', opfname => 'jsonb_ops' },
173173
{ oid => '4034',
174174
opfmethod => 'hash', opfname => 'jsonb_ops' },
175-
{ oid => '4035',
176-
opfmethod => 'gist', opfname => 'jsonb_ops' },
177175
{ oid => '4036',
178176
opfmethod => 'gin', opfname => 'jsonb_ops' },
179177
{ oid => '4037',

src/test/regress/expected/opr_sanity.out

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,6 +1686,16 @@ WHERE p1.opfmethod = 0 OR p1.opfnamespace = 0;
16861686
-----
16871687
(0 rows)
16881688

1689+
-- Look for opfamilies having no opclasses. While most validation of
1690+
-- opfamilies is now handled by AM-specific amvalidate functions, that's
1691+
-- driven from pg_opclass entries below, so an empty opfamily would not
1692+
-- get noticed.
1693+
SELECT oid, opfname FROM pg_opfamily f
1694+
WHERE NOT EXISTS (SELECT 1 FROM pg_opclass WHERE opcfamily = f.oid);
1695+
oid | opfname
1696+
-----+---------
1697+
(0 rows)
1698+
16891699
-- **************** pg_opclass ****************
16901700
-- Look for illegal values in pg_opclass fields
16911701
SELECT p1.oid

src/test/regress/sql/opr_sanity.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,6 +1122,14 @@ SELECT p1.oid
11221122
FROM pg_opfamily as p1
11231123
WHERE p1.opfmethod = 0 OR p1.opfnamespace = 0;
11241124

1125+
-- Look for opfamilies having no opclasses. While most validation of
1126+
-- opfamilies is now handled by AM-specific amvalidate functions, that's
1127+
-- driven from pg_opclass entries below, so an empty opfamily would not
1128+
-- get noticed.
1129+
1130+
SELECT oid, opfname FROM pg_opfamily f
1131+
WHERE NOT EXISTS (SELECT 1 FROM pg_opclass WHERE opcfamily = f.oid);
1132+
11251133

11261134
-- **************** pg_opclass ****************
11271135

0 commit comments

Comments
 (0)