Open jusongchen opened 9 months ago
The correct type for the Name
field would be sql.NullString
. With PostgreSQL and the database-backed analyzer turned on that is the result. I would expect a forthcoming MySQL database-backed analyzer will resolve this.
I have the same. interface{}
is generated instead of sql.NullString
.
Do you plan to add support for pointers for nullable parameters in MySQL engine?
Version
1.24.0
What happened?
Given this SQL on mysql
sqlc (version 1.18 and later) generates this data type
This results in error 'converting NULL to string is unsupported' as a NULL value on a db row cannot be stored to a string field.
The same query works on the sqlc version 1.17.2 as it generates this struct:
Relevant log output
No response
Database schema
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/1319e7502b91a9af5a5552b4cfc3d37284d047b40121f477dc05c5ec427b4ceb
What operating system are you using?
macOS
What database engines are you using?
MySQL
What type of code are you generating?
Go