Skip to content

Using an @ in a string passed to Select results in incorrect query #7235

Description

@markhildreth-gravity

GORM Playground Link

go-gorm/playground#764

Description

When using the @ character in a string passed to Select(), the remaining strings passed to select are ignored.

For example, these two queries...

DB.Table("users").Select("name = 'test example.com' as is_example", "age").Scan(&results).Error
DB.Table("users").Select("name = 'test@example.com' as is_example", "age").Scan(&results).Error

... generates the following SQL, respectively...

SELECT name = 'test example.com' as is_example,age FROM `users`
SELECT name = 'test@example.com' as is_example FROM `users`

Note how in the second, age is left off. This only seems to happen if the @ is included in the first string.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions