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
Prisma Client mixes up DateTimes and IDs when they are select
ed in queries
#2501
Comments
select
ed in queries
Thanks for another great write up 👍 I can reproduce this. Version information:
SQL required for database creation: CREATE TABLE "public"."Area" (
"createdAt" timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,"id" text NOT NULL ,"name" text NOT NULL ,"score" Decimal(65,30) ,"updatedAt" timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY ("id"))
CREATE TABLE "public"."Block" (
"areaId" text NOT NULL ,"createdAt" timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,"id" text NOT NULL ,"updatedAt" timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY ("id"))
ALTER TABLE "public"."Block" ADD FOREIGN KEY ("areaId")REFERENCES "public"."Area"("id") ON DELETE CASCADE ON UPDATE CASCADE |
Cool! Impressed by the quick response guys, and excited for a resolution 😊 |
Yes, same bug. PANIC: called Result::unwrap() on an Err value: ErrorMessage { msg: "Could not parse stored DateTime string: 2020-05-19 02:07:54 (input contains invalid characters)" } My schema is:
The command is:
|
Please add the SQL to the issue, so usage of Migrate is not required to reproduce this. |
CREATE TABLE "public"."Area" (
"createdAt" timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,"id" text NOT NULL ,"name" text NOT NULL ,"score" Decimal(65,30) ,"updatedAt" timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY ("id"))
CREATE TABLE "public"."Block" (
"areaId" text NOT NULL ,"createdAt" timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,"id" text NOT NULL ,"updatedAt" timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY ("id"))
ALTER TABLE "public"."Block" ADD FOREIGN KEY ("areaId")REFERENCES "public"."Area"("id") ON DELETE CASCADE ON UPDATE CASCADE |
Fixed with 2.0.0-alpha.1205 onwards. |
I am still able to reproduce this with the latest alpha. Assigning @pantharshit00 to reconfirm. |
Can't confirm that the issue is still appearing on latest alpha. All raw GraphQL queries against the engine produce the expected result. Are you sure you were on or above the listed alpha version? |
I can confirm that it works too, using the schema & script I posted in the OP. |
I also can't reproduce this with |
Sounds good, thanks for the confirmation everyone. |
Bug description
Originally found by @rmatei in prisma/studio#416
How to reproduce
Use this schema:
And use this script:
You should see this error:
This seems similar to #2442, in that the problem seems to be with the
select
argument of thecreate
query. If I don'tselect
anything, then the script does not crash.This time though, QE seems to be mixing up DateTimes and IDs.
If you think this is the same issue, please feel free to close this and add this as a comment to #2442
Expected behavior
select
(or if I don't use it at all) should not dictate if the script crashes or not.Environment & setup
The text was updated successfully, but these errors were encountered: