Skip to content
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

Postgres integer column silently overflows to bad value #13913

Closed
jajarzombek opened this issue Jun 20, 2022 · 1 comment · Fixed by prisma/prisma-engines#3231 or prisma/quaint#415
Closed
Assignees
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/client Issue for team Client. topic: client types Types in Prisma Client
Milestone

Comments

@jajarzombek
Copy link

jajarzombek commented Jun 20, 2022

Bug description

On inserting record into table with integer column a value that overflows postgres max integer value of 2147483647 no error message is returned and record with bad value is silently stored.
E.g. 2265000000 is saved as -2029967296

How to reproduce

  1. Create table with int column
  2. Insert record via Prisma with value that exceeds max postgres integer
  3. Wrong value in table is stored

Expected behavior

An error should be thrown

Prisma information

generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["improvedQueryRaw"]
}

datasource db {
  provider = "postgresql"
}

Prisma Version

3.15
@jajarzombek jajarzombek added the kind/bug A reported bug. label Jun 20, 2022
@matthewmueller matthewmueller added team/client Issue for team Client. topic: native database types topic: client types Types in Prisma Client bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. and removed topic: native database types labels Jun 21, 2022
@pimeys pimeys self-assigned this Sep 1, 2022
@pimeys pimeys added bug/2-confirmed Bug has been reproduced and confirmed. and removed bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. labels Sep 1, 2022
@pimeys
Copy link
Contributor

pimeys commented Sep 1, 2022

There was some prior work to fix this here: prisma/prisma-engines#2921

But, the default postgres type for ints is integer, and that's a 32-bit value. We should improve the validation here.

@pimeys pimeys removed their assignment Sep 1, 2022
@Weakky Weakky self-assigned this Sep 26, 2022
@janpio janpio added this to the 4.4.0 milestone Sep 26, 2022
@millsp millsp self-assigned this Sep 26, 2022
danstarns added a commit that referenced this issue Sep 27, 2022
* test(client): int overflow

* make tests pass for data proxy

* add comment about the dataproxy issue

* refactor: move to use allProviders

Co-authored-by: Daniel Starns <danielstarns@hotmail.com>
@millsp millsp reopened this Sep 27, 2022
@janpio janpio modified the milestones: 4.4.0, 4.6.0 Oct 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/client Issue for team Client. topic: client types Types in Prisma Client
Projects
None yet
7 participants