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
sqlc fails to generate when columns of a joined table are referenced in an UPDATE statement. It should be able to generate successfully.
Relevant log output
sqlc generate failed.
# package db
query.sql:16:1: column "user_id" does not exist
query.sql:24:1: column "user_id" does not exist
query.sql:32:1: column "user_id" does not exist
Database schema
CREATETABLEprimary_table (
id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
user_id bigint(20) unsigned NOT NULL,
PRIMARY KEY (id)
);
CREATETABLEjoin_table (
id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
primary_table_id bigint(20) unsigned NOT NULL,
other_table_id bigint(20) unsigned NOT NULL,
is_active tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (id)
);
SQL queries
-- name: UpdateJoin :execUPDATE join_table as jt
JOIN primary_table as pt
ONjt.primary_table_id=pt.idSETjt.is_active= ?
WHEREjt.id= ?
ANDpt.user_id= ?;
-- name: UpdateLeftJoin :execUPDATE join_table as jt
LEFT JOIN primary_table as pt
ONjt.primary_table_id=pt.idSETjt.is_active= ?
WHEREjt.id= ?
ANDpt.user_id= ?;
-- name: UpdateRightJoin :execUPDATE join_table as jt
RIGHT JOIN primary_table as pt
ONjt.primary_table_id=pt.idSETjt.is_active= ?
WHEREjt.id= ?
ANDpt.user_id= ?;
Version
1.10.0
What happened?
sqlc fails to generate when columns of a joined table are referenced in an UPDATE statement. It should be able to generate successfully.
Relevant log output
Database schema
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/07be9068523e941e24fd73bea8ec61cbfa82e4ca653d322832e09a1fd2574f8f
What operating system are you using?
Linux
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: