We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When passing an empty list to a query that coerces it to timestamps, a subsequent call with a non empty list causes the db to throw an exception.
Throws ERROR: improper binary format in array element 1:
ERROR: improper binary format in array element 1
await client.query_raw("select $1::timestamp[]", []) await client.query_raw("select $1::timestamp[]", ["2024-06-17T21:34:42"])
If the list is always non-empty or the list is always empty, everything works fine.
Works fine:
await client.query_raw("select $1::timestamp[]", []) await client.query_raw("select $1::timestamp[]", [])
Also works fine:
await client.query_raw("select $1::timestamp[]", ["2024-05-17T21:34:42"]) await client.query_raw("select $1::timestamp[]", ["2024-06-17T21:34:42"])
This wasn't terribly hard to work around once we understood what was happening, but took a bit of effort to debug because of the surprising behavior.
Run example.py with a postgresql database:
DATABASE_URL="postgresql://[email protected]:5432/postgres" python -m example
example.py
import asyncio from prisma import Prisma async def main(): client = Prisma() await client.connect() print(await client.query_raw("select $1::timestamp[]", [])) print(await client.query_raw("select $1::timestamp[]", ["2024-06-17T21:34:42"])) await client.disconnect() asyncio.run(main())
Prisma/PostgreSQL throws
prisma.errors.RawQueryError: ERROR: improper binary format in array element 1
Not relevant
prisma : 5.11.0 @prisma/client : Not found Computed binaryTarget : darwin-arm64 Operating System : darwin Architecture : arm64 Node.js : v20.10.0 Query Engine (Binary) : query-engine efd2449663b3d73d637ea1fd226bafbcf45b3102 (at ../../../.cache/prisma-python/binaries/5.11.0/efd2449663b3d73d637ea1fd226bafbcf45b3102/node_modules/@prisma/engines/query-engine-darwin-arm64) Schema Engine : schema-engine-cli efd2449663b3d73d637ea1fd226bafbcf45b3102 (at ../../../.cache/prisma-python/binaries/5.11.0/efd2449663b3d73d637ea1fd226bafbcf45b3102/node_modules/@prisma/engines/schema-engine-darwin-arm64) Schema Wasm : @prisma/prisma-schema-wasm 5.11.0-15.efd2449663b3d73d637ea1fd226bafbcf45b3102 Default Engines Hash : efd2449663b3d73d637ea1fd226bafbcf45b3102 Studio : 0.499.0
The text was updated successfully, but these errors were encountered:
Thanks for the detailed bug report, I can reproduce the error. I've also verified that this doesn't happen in the JS client.
Sorry, something went wrong.
Thanks for investigating. Again, low priority on our end due to there being an easy workaround.
No branches or pull requests
Bug description
When passing an empty list to a query that coerces it to timestamps,
a subsequent call with a non empty list causes the db to throw an exception.
Throws
ERROR: improper binary format in array element 1
:If the list is always non-empty or the list is always empty, everything works fine.
Works fine:
Also works fine:
This wasn't terribly hard to work around once we understood what was happening,
but took a bit of effort to debug because of the surprising behavior.
How to reproduce
Run example.py with a postgresql database:
DATABASE_URL="postgresql://[email protected]:5432/postgres" python -m example
example.py
Expected behavior
Prisma/PostgreSQL throws
Prisma information
Not relevant
Environment & setup
The text was updated successfully, but these errors were encountered: