Check constraint works only with lowercase #7848
-
As you can see, it always converts everything in all lowercase format, therefore if you check a column that is not completely lowercase you will get this error |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This is because of the way Postgres treats identifiers. By default all identifiers are lowercased by Postgres if not wrapped with double-quotes. Fom the Postgres docs: "Quoting an identifier also makes it case-sensitive, whereas unquoted names are always folded to lower case. For example, the identifiers FOO, foo, and "foo" are considered the same by PostgreSQL, but "Foo" and "FOO" are different from these three and each other." For your case, updating the constraint to |
Beta Was this translation helpful? Give feedback.
This is because of the way Postgres treats identifiers. By default all identifiers are lowercased by Postgres if not wrapped with double-quotes.
Fom the Postgres docs: "Quoting an identifier also makes it case-sensitive, whereas unquoted names are always folded to lower case. For example, the identifiers FOO, foo, and "foo" are considered the same by PostgreSQL, but "Foo" and "FOO" are different from these three and each other."
For your case, updating the constraint to
"NAME" != null
should fix this.