Skip to content

Latest commit

 

History

History
49 lines (39 loc) · 1.13 KB

README.md

File metadata and controls

49 lines (39 loc) · 1.13 KB

in brief

These two queries are almost identical except for the order of the comparisons in lines 3 and 4:

SELECT uid FROM emails
WHERE expunged = 0 AND user_id = ? AND mailbox_server_id = ?
  AND uid >= ?
  AND uid <= ?
ORDER BY uid ASC;
SELECT uid FROM emails
WHERE expunged = 0 AND user_id = ? AND mailbox_server_id = ?
  AND ? <= uid
  AND ? >= uid
ORDER BY uid ASC;

However sqlc generates different param structs:

type UidRangeRightParams struct {
	UserID          string `db:"user_id" json:"user_id"`
	MailboxServerID string `db:"mailbox_server_id" json:"mailbox_server_id"`
	Uid             int64  `db:"uid" json:"uid"`
	Uid_2           int64  `db:"uid_2" json:"uid_2"`
}
type UidRangeWrongParams struct {
	UserID          string      `db:"user_id" json:"user_id"`
	MailboxServerID string      `db:"mailbox_server_id" json:"mailbox_server_id"`
	Column3         interface{} `db:"column_3" json:"column_3"`
	Column4         interface{} `db:"column_4" json:"column_4"`
}

how to regenerate

cd database && sqlc generate

bug location

submitted as sqlc-dev/sqlc#2032