@@ -342,6 +342,7 @@ async def _get_statement(
342
342
* ,
343
343
named : bool = False ,
344
344
use_cache : bool = True ,
345
+ ignore_custom_codec = False ,
345
346
record_class = None
346
347
):
347
348
if record_class is None :
@@ -403,7 +404,7 @@ async def _get_statement(
403
404
404
405
# Now that types have been resolved, populate the codec pipeline
405
406
# for the statement.
406
- statement ._init_codecs ()
407
+ statement ._init_codecs (ignore_custom_codec )
407
408
408
409
if need_reprepare :
409
410
await self ._protocol .prepare (
@@ -426,7 +427,12 @@ async def _get_statement(
426
427
427
428
async def _introspect_types (self , typeoids , timeout ):
428
429
return await self .__execute (
429
- self ._intro_query , (list (typeoids ),), 0 , timeout )
430
+ self ._intro_query ,
431
+ (list (typeoids ),),
432
+ 0 ,
433
+ timeout ,
434
+ ignore_custom_codec = True ,
435
+ )
430
436
431
437
async def _introspect_type (self , typename , schema ):
432
438
if (
@@ -439,20 +445,22 @@ async def _introspect_type(self, typename, schema):
439
445
[typeoid ],
440
446
limit = 0 ,
441
447
timeout = None ,
448
+ ignore_custom_codec = True ,
442
449
)
443
- if rows :
444
- typeinfo = rows [0 ]
445
- else :
446
- typeinfo = None
447
450
else :
448
- typeinfo = await self .fetchrow (
449
- introspection .TYPE_BY_NAME , typename , schema )
451
+ rows = await self ._execute (
452
+ introspection .TYPE_BY_NAME ,
453
+ [typename , schema ],
454
+ limit = 1 ,
455
+ timeout = None ,
456
+ ignore_custom_codec = True ,
457
+ )
450
458
451
- if not typeinfo :
459
+ if not rows :
452
460
raise ValueError (
453
461
'unknown type: {}.{}' .format (schema , typename ))
454
462
455
- return typeinfo
463
+ return rows [ 0 ]
456
464
457
465
def cursor (
458
466
self ,
@@ -1589,6 +1597,7 @@ async def _execute(
1589
1597
timeout ,
1590
1598
* ,
1591
1599
return_status = False ,
1600
+ ignore_custom_codec = False ,
1592
1601
record_class = None
1593
1602
):
1594
1603
with self ._stmt_exclusive_section :
@@ -1599,6 +1608,7 @@ async def _execute(
1599
1608
timeout ,
1600
1609
return_status = return_status ,
1601
1610
record_class = record_class ,
1611
+ ignore_custom_codec = ignore_custom_codec ,
1602
1612
)
1603
1613
return result
1604
1614
@@ -1610,6 +1620,7 @@ async def __execute(
1610
1620
timeout ,
1611
1621
* ,
1612
1622
return_status = False ,
1623
+ ignore_custom_codec = False ,
1613
1624
record_class = None
1614
1625
):
1615
1626
executor = lambda stmt , timeout : self ._protocol .bind_execute (
@@ -1620,6 +1631,7 @@ async def __execute(
1620
1631
executor ,
1621
1632
timeout ,
1622
1633
record_class = record_class ,
1634
+ ignore_custom_codec = ignore_custom_codec ,
1623
1635
)
1624
1636
1625
1637
async def _executemany (self , query , args , timeout ):
@@ -1637,20 +1649,23 @@ async def _do_execute(
1637
1649
timeout ,
1638
1650
retry = True ,
1639
1651
* ,
1652
+ ignore_custom_codec = False ,
1640
1653
record_class = None
1641
1654
):
1642
1655
if timeout is None :
1643
1656
stmt = await self ._get_statement (
1644
1657
query ,
1645
1658
None ,
1646
1659
record_class = record_class ,
1660
+ ignore_custom_codec = ignore_custom_codec ,
1647
1661
)
1648
1662
else :
1649
1663
before = time .monotonic ()
1650
1664
stmt = await self ._get_statement (
1651
1665
query ,
1652
1666
timeout ,
1653
1667
record_class = record_class ,
1668
+ ignore_custom_codec = ignore_custom_codec ,
1654
1669
)
1655
1670
after = time .monotonic ()
1656
1671
timeout -= after - before
0 commit comments