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

Method test_regdatabase

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

Source from the content-addressed store, hash-verified

585 await self.con.fetchval('SELECT $1::oid8', '42')
586
587 async def test_regdatabase(self):
588 if self.server_version < (19, 0):
589 self.skipTest('regdatabase requires PostgreSQL 19 or later')
590
591 oid = await self.con.fetchval(
592 "SELECT oid FROM pg_database WHERE datname = 'postgres'")
593 result = await self.con.fetchval('SELECT $1::regdatabase', str(oid))
594 self.assertEqual(result, 'postgres')
595
596 result = await self.con.fetchval(
597 "SELECT current_database()::regdatabase")
598 self.assertEqual(result, await self.con.fetchval(
599 'SELECT current_database()'))
600
601 async def test_void(self):
602 res = await self.con.fetchval('select pg_sleep(0)')

Callers

nothing calls this directly

Calls 1

fetchvalMethod · 0.45

Tested by

no test coverage detected