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
When using sqlc with a MySQL schema that includes a POINT column (a spatial data type), the sqlc generate command fails with a syntax error. The POINT type is a valid MySQL data type for storing geometric coordinates, but it appears sqlc does not recognize or parse it correctly during schema validation, leading to a generation failure.
Steps to Reproduce
Create a schema.sql file with the following content:
CREATETABLE `users_addresses` (
`id`int UNSIGNED NOT NULL,
`user_id`int UNSIGNED NOT NULL,
`address`varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
`postal_code`char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
`location`pointNOT NULL,
`created_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
sqlc should parse the POINT data type as a valid MySQL type and generate Go code, ideally mapping it to a reasonable default type (e.g., []byte for WKB format) or allowing custom type overrides for spatial libraries like github.com/twpayne/go-geom.
Actual Behavior
The command fails with the following error:
sqlc generate
# package
schema.sql:6:52: syntax error near "point NOT NULL,"
Environment
sqlc Version: [e.g., v1.26.0 — replace with your version; check with sqlc version]
Database: MySQL (e.g., 8.0.32)
OS: [e.g., Ubuntu 22.04, macOS 14, etc.]
Go Version: [e.g., go1.21.6]
Relevant log output
schema.sql:6:52: syntax error near "point NOT NULL,"
Database schema
CREATETABLE `users_addresses` (
`id`int UNSIGNED NOT NULL,
`user_id`int UNSIGNED NOT NULL,
`address`varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
`postal_code`char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
`location`pointNOT NULL,
`created_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
Version
1.28.0
What happened?
Description
When using
sqlc
with a MySQL schema that includes aPOINT
column (a spatial data type), thesqlc generate
command fails with a syntax error. ThePOINT
type is a valid MySQL data type for storing geometric coordinates, but it appearssqlc
does not recognize or parse it correctly during schema validation, leading to a generation failure.Steps to Reproduce
schema.sql
file with the following content:sqlc.yaml
for MySQL:sqlc generate
.Expected Behavior
sqlc
should parse thePOINT
data type as a valid MySQL type and generate Go code, ideally mapping it to a reasonable default type (e.g.,[]byte
for WKB format) or allowing custom type overrides for spatial libraries likegithub.ghproxy.top/twpayne/go-geom
.Actual Behavior
Environment
v1.26.0
— replace with your version; check withsqlc version
]go1.21.6
]Relevant log output
schema.sql:6:52: syntax error near "point NOT NULL,"
Database schema
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/105f1e1d837c27b36207923cf8c947d4f6041dfcf90a76cef590bcca3bacd2ac
What operating system are you using?
macOS
What database engines are you using?
MySQL
What type of code are you generating?
Go
The text was updated successfully, but these errors were encountered: