Closed ponomar closed 1 year ago
I mean if these are small bugs or these behaviours are designed such way?
This is expected behavior. Asyncpg relies on PostgreSQL type inference to determine the expected types of the arguments. In SELECT $1
there is no context, so the default text
type is inferred.
Case 1
asyncpg.exceptions.DataError: invalid input for query argument $1: 1 (expected str, got int)
While 2 similar work fine:
It can not handle integers automatically?
Case 2
Fails with the same error as above, while next query works fine (when parameter in Else statement):
Case 3
asyncpg.exceptions.PostgresSyntaxError: syntax error at or near "$1"