Skip to content

Commit ddb0ec2

Browse files
committed
Fix large OID test under PostgreSQL 11
PostgreSQL 11 seems to be automatically creating array types for domains with OIDs that _precede_ the OID of the array element type, so the large OID test trips over with an off-by-one assertion error.
1 parent 97aad83 commit ddb0ec2

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

tests/test_codecs.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1727,10 +1727,12 @@ async def test_no_result(self):
17271727

17281728
@unittest.skipIf(os.environ.get('PGHOST'), 'using remote cluster for testing')
17291729
class TestCodecsLargeOIDs(tb.ConnectedTestCase):
1730+
LARGE_OID = 2147483648
1731+
17301732
@classmethod
17311733
def setup_cluster(cls):
17321734
cls.cluster = cls.new_cluster(pg_cluster.TempCluster)
1733-
cls.cluster.reset_wal(oid=2147483648)
1735+
cls.cluster.reset_wal(oid=cls.LARGE_OID)
17341736
cls.start_cluster(cls.cluster)
17351737

17361738
async def test_custom_codec_large_oid(self):
@@ -1739,7 +1741,15 @@ async def test_custom_codec_large_oid(self):
17391741
oid = await self.con.fetchval('''
17401742
SELECT oid FROM pg_type WHERE typname = 'test_domain_t'
17411743
''')
1742-
self.assertEqual(oid, 2147483648)
1744+
1745+
expected_oid = self.LARGE_OID
1746+
if self.server_version >= (11, 0):
1747+
# PostgreSQL 11 automatically create a domain array type
1748+
# _before_ the domain type, so the expected OID is
1749+
# off by one.
1750+
expected_oid += 1
1751+
1752+
self.assertEqual(oid, expected_oid)
17431753

17441754
# Test that introspection handles large OIDs
17451755
v = await self.con.fetchval('SELECT $1::test_domain_t', 10)

0 commit comments

Comments
 (0)