Skip to content

Error for INSERT using prepared statement with timestamp column #1419

New issue

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

Open
tbantle22 opened this issue Apr 23, 2025 · 0 comments
Open

Error for INSERT using prepared statement with timestamp column #1419

tbantle22 opened this issue Apr 23, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@tbantle22
Copy link
Contributor

I have a table that looks like this:

CREATE TABLE "employees" (
    "emp_no" INTEGER NOT NULL,
    "birth_date" TIMESTAMP(3) NOT NULL,
    "first_name" VARCHAR(14) NOT NULL,
    "last_name" VARCHAR(16) NOT NULL,
    "hire_date" TIMESTAMP(3) NOT NULL,

    CONSTRAINT "employees_pkey" PRIMARY KEY ("emp_no")
);

And when I try to seed that table using Prisma, it fails on insert with this error:

ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(PostgresError { code: "XX000", message: "unable to convert bind parameter: cannot scan timestamp (OID 1114) in binary format into *string", severity: "ERROR", detail: None, column: None, hint: None }), transient: false })

This is the query/bindings in the server logs:

DEBU[0548] Query finished in 3 ms                        connectTime="2025-04-23 11:35:21.44394 -0700 PDT m=+548.272238626" connectionDb=postgres connectionID=1 query="SET database TO 'postgres';"
DEBU[0548] Received message: {"Type":"Parse","Name":"s0","Query":"INSERT INTO \"public\".\"employees\" (\"emp_no\",\"birth_date\",\"first_name\",\"last_name\",\"hire_date\") VALUES ($1,$2,$3,$4,$5) RETURNING \"public\".\"employees\".\"emp_no\", \"public\".\"employees\".\"birth_date\", \"public\".\"employees\".\"first_name\", \"public\".\"employees\".\"last_name\", \"public\".\"employees\".\"hire_date\"","ParameterOIDs":null}
DEBU[0548] Received message: {"Type":"Describe","ObjectType":"S","Name":"s0"}
DEBU[0548] Received message: {"Type":"Sync"}
DEBU[0548] Received message: {"Type":"Bind","DestinationPortal":"","PreparedStatement":"s0","ParameterFormatCodes":[1,1,1,1,1],"Parameters":[{"binary":"00002711"},{"binary":"ffface4371604000"},{"binary":"47656f726769"},{"binary":"466163656c6c6f"},{"binary":"fffe7c0c8175a000"}],"ResultFormatCodes":[1]}
@tbantle22 tbantle22 added the bug Something isn't working label Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants