What is the best way to debug PostgreSQL error "Th...
# prisma-client
r
What is the best way to debug PostgreSQL error "The provided value for the column is too long for the column's type. Column: (not available)"?
I'm fairly confident that no column is too long
The only thing I'm wondering that what does Prisma do in case where in the database I have cidr and I've mapped that as a String type in prisma schema?
j
hmm, what version of postgres you're running?
this comes from the client?
r
Yes
PostgreSQL 12
prisma 2.21.0
j
interesting that you get
(not available)
, are you using the database in some other language than english?
the postgres error is
22001
, meaning you try to insert a string value to a field that doesn't fit https://www.postgresql.org/docs/12/errcodes-appendix.html
r
No
j
it should give you the column name though
can you file an issue for the missing column name?
r
Sure
I try to find time during the weekend
j
and then see your insert params, is the string too long to fit to a column that's probably a
VARCHAR(n)
where the
n
is smaller than the length of your string
r
I might need to triple check the columns 😅
I have a couple columns defined as TEXT in the DB. Isn't it so that it is enough to map that as a String and nothing else?
I do have the @db.VarChar definitions for the VARCHAR columns in the prisma schema as well
j
TEXT
should fit about 2GB of data if I remember right
VARCHAR
is much much faster to search, so if your data fits into that type, use it
r
Sure, it's user_agent, but maybe I can just set it big enough 🙂
j
mm, even the maximum size
VARCHAR
is better than
TEXT
if you know you never go over the length
r
Yeah
@Julius de Bruijn went through the columns once more, and Indeed, I had a column that was too long (surprise!), but it was a little difficult to spot because the column name was unavailable. I'll submit an issue later today
j
yeah, we'll try to find the reason why exactly your postgres version doesn't give us this info. I have plans to redo the errors, but that is kind of a big change, and I'm not sure yet is it the right one...
but this ticket might be one more vote to do that