Skip to content

fix: Search from Rexpr if not found from Lexpr #2056

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 13, 2023

Conversation

zaneli
Copy link
Contributor

@zaneli zaneli commented Feb 9, 2023

fixed #2032

Although the existing test failed, I think this change is the more correct behavior.. 🤔 5ae75fd

--- FAIL: TestReplay (0.11s)
    --- FAIL: TestReplay/testdata/params_duplicate/postgresql (0.01s)
        /Users/zaneli/go/src/github.com/zaneli/sqlc/internal/endtoend/endtoend_test.go:170: /Users/zaneli/go/src/github.com/zaneli/sqlc/internal/endtoend/testdata/params_duplicate/postgresql contents differ
        --- FAIL: TestReplay/testdata/params_duplicate/postgresql/go/query.sql.go (0.00s)
            /Users/zaneli/go/src/github.com/zaneli/sqlc/internal/endtoend/endtoend_test.go:180: /Users/zaneli/go/src/github.com/zaneli/sqlc/internal/endtoend/testdata/params_duplicate/postgresql/go/query.sql.go differed (-want +got):
                  (
                  	"""
                  	... // 15 identical lines
                  	`
                  	
                - 	func (q *Queries) SelectUserByID(ctx context.Context, id interface{}) ([]sql.NullString, error) {
                + 	func (q *Queries) SelectUserByID(ctx context.Context, id int32) ([]sql.NullString, error) {
                  		rows, err := q.db.QueryContext(ctx, selectUserByID, id)
                  		if err != nil {
                  	... // 53 identical lines
                  	`
                  	
                - 	func (q *Queries) SelectUserQuestion(ctx context.Context, dollar_1 interface{}) ([]sql.NullString, error) {
                - 		rows, err := q.db.QueryContext(ctx, selectUserQuestion, dollar_1)
                + 	func (q *Queries) SelectUserQuestion(ctx context.Context, id int32) ([]sql.NullString, error) {
                + 		rows, err := q.db.QueryContext(ctx, selectUserQuestion, id)
                  		if err != nil {
                  			return nil, err
                  	... // 19 identical lines
                  	"""
                  )
    --- FAIL: TestReplay/testdata/params_duplicate/mysql (0.01s)
        /Users/zaneli/go/src/github.com/zaneli/sqlc/internal/endtoend/endtoend_test.go:170: /Users/zaneli/go/src/github.com/zaneli/sqlc/internal/endtoend/testdata/params_duplicate/mysql contents differ
        --- FAIL: TestReplay/testdata/params_duplicate/mysql/go/query.sql.go (0.00s)
            /Users/zaneli/go/src/github.com/zaneli/sqlc/internal/endtoend/endtoend_test.go:180: /Users/zaneli/go/src/github.com/zaneli/sqlc/internal/endtoend/testdata/params_duplicate/mysql/go/query.sql.go differed (-want +got):
                  (
                  	"""
                  	... // 16 identical lines
                  	
                  	type SelectUserByIDParams struct {
                - 		ID interface{}
                + 		ID int32
                  	}
                  	
                  	... // 61 identical lines
                  	
                  	type SelectUserQuestionParams struct {
                - 		Column1 interface{}
                + 		ID      int32
                  		Column2 interface{}
                  	}
                  	
                  	func (q *Queries) SelectUserQuestion(ctx context.Context, arg SelectUserQuestionParams) ([]sql.NullString, error) {
                - 		rows, err := q.db.QueryContext(ctx, selectUserQuestion, arg.Column1, arg.Column2)
                + 		rows, err := q.db.QueryContext(ctx, selectUserQuestion, arg.ID, arg.Column2)
                  		if err != nil {
                  			return nil, err
                  	... // 19 identical lines
                  	"""
                  )
FAIL
FAIL	github.com/kyleconroy/sqlc/internal/endtoend	1.451s
FAIL

@kyleconroy kyleconroy merged commit eba90d1 into sqlc-dev:main Feb 13, 2023
@zaneli zaneli deleted the fix/search-node-from-rexpr branch February 13, 2023 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sqlite: comparison order affects generation of param structs
2 participants