MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / test_custom_codec_large_oid

Method test_custom_codec_large_oid

tests/test_codecs.py:1989–2010  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1987 cls.start_cluster(cls.cluster)
1988
1989 async def test_custom_codec_large_oid(self):
1990 await self.con.execute('CREATE DOMAIN test_domain_t AS int')
1991 try:
1992 oid = await self.con.fetchval('''
1993 SELECT oid FROM pg_type WHERE typname = 'test_domain_t'
1994 ''')
1995
1996 expected_oid = self.LARGE_OID
1997 if self.server_version >= (11, 0):
1998 # PostgreSQL 11 automatically creates a domain array type
1999 # _before_ the domain type, so the expected OID is
2000 # off by one.
2001 expected_oid += 1
2002
2003 self.assertEqual(oid, expected_oid)
2004
2005 # Test that introspection handles large OIDs
2006 v = await self.con.fetchval('SELECT $1::test_domain_t', 10)
2007 self.assertEqual(v, 10)
2008
2009 finally:
2010 await self.con.execute('DROP DOMAIN test_domain_t')

Callers

nothing calls this directly

Calls 2

executeMethod · 0.45
fetchvalMethod · 0.45

Tested by

no test coverage detected