question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add option to skip unnecessary select after create

See original GitHub issue

Problem

Every time you do operation with prisma-client it will make unnecessary select and return value

Query:

db.log
   .create({
      data: {
         smth: 1
      },
      select: { uuid: true }, // unnecessary select, even if you delete this line
   })

Logs:

prisma:query COMMIT
prisma:query BEGIN
prisma:query INSERT INTO "public"."log" ("smth") VALUES ($1) RETURNING "public"."log"."uuid"
prisma:query SELECT "public"."log"."uuid" FROM "public"."log" WHERE "public"."log"."uuid" = $1 LIMIT $2 OFFSET $3
prisma:query COMMIT

Suggested solution

Add option to skip select after insert or update (in case of operation fail error is thrown by default)

db.log
   .create({
      data: {
         smth: 1
      },
      select: false
   })

Logs:

prisma:query COMMIT
prisma:query BEGIN
prisma:query INSERT INTO "public"."log" ("smth") VALUES ($1)"
prisma:query COMMIT

Alternative solution (breaking change)

Do not return anything after insert or update if select was not explicitly set.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:56
  • Comments:17 (2 by maintainers)

github_iconTop GitHub Comments

27reactions
PranavSathycommented, Mar 15, 2021

Is there any movement on this? Not sure if this is as relevant, but those select’s (after insert even though I haven’t specified a select argument) do eat into the transaction buffer limit.

5reactions
rohanrajpalcommented, Jul 23, 2022

Would appreciate an option to remove the unnecessary select

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to remove/skip empty lines from option select list
Hi Folks ^^ this worked for me : <select formControlName="type" id="type" > <option [selected]=true [disabled]="true" value="" >Choose ...
Read more >
Manage email messages by using rules - Microsoft Support
Right-click a message in your inbox or another email folder and select Rules. Right-click a message you received to create a rule. Select...
Read more >
Skip Logic - Qualtrics
Additional Skip Logic Options. After adding skip logic to a question, you can select the skip logic dropdown menu to the right of...
Read more >
How to INSERT If Row Does Not Exist (UPSERT) in MySQL
Learn how to INSERT an If Row Does Not Exist (UPSERT) in MySQL. MySQL provides a number of useful statements when it is...
Read more >
Question Skip Logic | SurveyMonkey Help
Video Overview; Question Types; Adding Logic; Page Options; Details ... Question Skip Logic lets you skip respondents to a later page, or a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found