Skip to content

Commit 2ed3ba9

Browse files
author
Woodhams
committed
Domain basetypes are introspected (MagicStack#886)
Add test for domain basetype introspections and loading
1 parent f89b3fb commit 2ed3ba9

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/test_introspection.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,3 +190,25 @@ async def wait_and_drop():
190190
DROP DOMAIN intro_2_t;
191191
''')
192192
await slow_intro_conn.close()
193+
194+
@tb.with_connection_options(database='asyncpg_intro_test')
195+
async def test_introspection_loads_basetypes_of_domains(self):
196+
# Test that basetypes of domains are loaded to the client encode/decode
197+
# cache
198+
await self.con.execute('''
199+
DROP TABLE IF EXISTS test;
200+
DROP DOMAIN IF EXISTS num_array;
201+
CREATE DOMAIN num_array numeric[];
202+
CREATE TABLE test (
203+
num num_array
204+
);
205+
''')
206+
207+
try:
208+
# if domain basetypes are not loaded, this insert will fail
209+
await self.con.execute('INSERT INTO test (num) VALUES ($1)', ([1, 2],))
210+
finally:
211+
await self.con.execute('''
212+
DROP TABLE IF EXISTS test;
213+
DROP DOMAIN IF EXISTS num_array;
214+
''')

0 commit comments

Comments
 (0)