@@ -633,17 +633,32 @@ async def test_numeric(self):
633633 "SELECT $1::numeric" , decimal .Decimal ('sNaN' ))
634634 self .assertTrue (res .is_nan ())
635635
636- with self .assertRaisesRegex (asyncpg .DataError ,
637- 'numeric type does not '
638- 'support infinite values' ):
639- await self .con .fetchval (
640- "SELECT $1::numeric" , decimal .Decimal ('-Inf' ))
636+ if self .server_version < (14 , 0 ):
637+ with self .assertRaisesRegex (
638+ asyncpg .DataError ,
639+ 'invalid sign in external "numeric" value'
640+ ):
641+ await self .con .fetchval (
642+ "SELECT $1::numeric" , decimal .Decimal ('-Inf' ))
641643
642- with self .assertRaisesRegex (asyncpg .DataError ,
643- 'numeric type does not '
644- 'support infinite values' ):
645- await self .con .fetchval (
646- "SELECT $1::numeric" , decimal .Decimal ('+Inf' ))
644+ with self .assertRaisesRegex (
645+ asyncpg .DataError ,
646+ 'invalid sign in external "numeric" value'
647+ ):
648+ await self .con .fetchval (
649+ "SELECT $1::numeric" , decimal .Decimal ('+Inf' ))
650+
651+ with self .assertRaisesRegex (asyncpg .DataError , 'invalid' ):
652+ await self .con .fetchval (
653+ "SELECT $1::numeric" , 'invalid' )
654+ else :
655+ res = await self .con .fetchval (
656+ "SELECT $1::numeric" , decimal .Decimal ("-Inf" ))
657+ self .assertTrue (res .is_infinite ())
658+
659+ res = await self .con .fetchval (
660+ "SELECT $1::numeric" , decimal .Decimal ("+Inf" ))
661+ self .assertTrue (res .is_infinite ())
647662
648663 with self .assertRaisesRegex (asyncpg .DataError , 'invalid' ):
649664 await self .con .fetchval (
0 commit comments