Code Monkey home page Code Monkey logo

Comments (3)

Druue avatar Druue commented on June 20, 2024

Hey @Hellio404, I can confirm the ""2100 parameters"" error message but I can't confirm the resolution by including the createdAt: true in the select, neither on dev nor on 5.3.1.

await prisma.post.findMany({
  where: { authorId: { in: Array.from(Array(4000).keys()) } },
-  select: { id: true, title: true },
+  select: { id: true, title: true, createdAt: true },
  orderBy: { createdAt: 'asc' },
});

Could you please provide a reproduction that shows this succeeding with the inclusion of createdAt in select

from prisma.

Hellio404 avatar Hellio404 commented on June 20, 2024

@Druue

I double checked and I confirm that adding the createdAt: true fixes the issue for me as well as removing select all together

  const { id } = await client.user.create({
    data: {
      posts: {
        createMany: {
          data: Array(4000).fill({title: 'post'}),
        }
      }
    }
  });
  // this works
  const sortedPosts = await client.post.findMany({
    where: { authorId: { in: Array.from(Array(4000).keys()) }},
    select: {id: true, title: true, createdAt: true},
    orderBy: {createdAt: 'asc'},
  });
  // this works too
  await client.post.findMany({
    where: { authorId: { in: Array.from(Array(4000).keys()) }},
    orderBy: {createdAt: 'asc'},
  });

from prisma.

Druue avatar Druue commented on June 20, 2024

Huh, I double checked in another repro repo and I can reproduce it there. You can see a link above. For some reason, however, I still cannot reproduce this in our internal reproductions dir that directly hooks into a locally-built version of the client. I have no idea what's going on there :/

Looking at the succeeding findMany query that includes createdAt: true, I see following two (minimised) SQL queries logged.

SELECT [dbo].[Post].[id], [dbo].[Post].[title], [dbo].[Post].[createdAt]
FROM [dbo].[Post]
WHERE [dbo].[Post].[authorId] IN (@P1 ... @P2098)

SELECT [dbo].[Post].[id], [dbo].[Post].[title], [dbo].[Post].[createdAt]
FROM [dbo].[Post]
WHERE [dbo].[Post].[authorId] IN (@P1 ... @P1902)

If I swap to the failing query that doesn't include createdAt: true, I see the following logged

SELECT [dbo].[Post].[id], [dbo].[Post].[title]
FROM [dbo].[Post]
WHERE [dbo].[Post].[authorId] IN (@P1 ... @P2098)

with the following error:

thread 'tokio-runtime-worker' panicked at query-engine/query-structure/src/record.rs:69:46:
no entry found for key
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This is the relevant code that it references

and then the following SQL query after:

SELECT [dbo].[Post].[id], [dbo].[Post].[title]
FROM [dbo].[Post]
WHERE [dbo].[Post].[authorId] IN (@P1 ... @P1902)

from prisma.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.