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
[Introspection] dot (and other non-[a-z0-9] characters) in field name #1106
Comments
Column names / field names BackgroundIn SQL, an identifier can be quoted. This generally mean that it is wrapped in a start and closing character. For Postgres this character is MySQL
https://dev.mysql.com/doc/refman/8.0/en/identifiers.html Postgres
https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS SQLiteNo constraints https://stackoverflow.com/questions/23770480/sqlite-table-and-column-name-requirements MongoDB
https://docs.mongodb.com/manual/reference/limits/#Restrictions-on-Field-Names DecisionWe will support the full space of names for each supported database. Note on the serialised Prisma Schema and spacesColumn and table names may contain spaces. We need to decide how we want to handle this in the Prisma Schema. For example, a Integer column named
To overcome this, we will introduce quoted identifiers:
The use of double quote is in line with the official SQL standard, but the resemblance is of no importance, as we also support non-SQL databases. |
Temporary GuardrailFor now we will simply replace any invalid character with So:
Become
|
Let's define some of the terms a little bit more: Invalid character -> everything that does not match the regex Replacement strategy:Everything invalid before the first character valid for start of the the identifier gets dropped. |
fixed via #1139 |
e.g. Vanilla schema
The text was updated successfully, but these errors were encountered: