You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SQL identifiers and key words must begin with a letter (a-z, but also letters with diacritical marks and non-Latin letters) or an underscore (_). Subsequent characters in an identifier or key word can be letters, underscores, digits (0-9), or dollar signs ($).
It seems that all identifiers are affected by this, not only function names. So even column names in table definitions are causing this error.
According to the PostgreSQL documentation, the dollar sign is not SQL standard compatible. So in the first place the question if identifiers with dollar signs should be reported as invalid or properly translated to valid go identifiers.
Interestingly the PostgresSQL identifier could also contain non-latin letters (e.g. áäâ...) but this matches the go language specification so these are fine. However I do not know if other language targets are affected by this.
Looking through the code the function names are not really relevant. So the naming of these could be quite simply changed. On the other side the column names are differently, as they are of course part of the public model. So possibly it would make sense to accept function names with dollar signs and reject column names with dollar signs.
Version
1.11.0
What happened?
When a function name is defined using a dollar sign ($) in the schema, sqlc reports an error:
Because the generator emits the identifier into the Go source:
The PostgreSQL documentation states:
4.1.1. Identifiers and Key Words
Additional points:
Relevant log output
No response
Database schema
No response
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/5920ab6d1c170a37455d6c5bab505f22c5d660645d96a465feffb559571fd221
What operating system are you using?
Linux, Windows
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go
The text was updated successfully, but these errors were encountered: