Go 1.13.7 - Postgres 12.2

Just wanted to report, I had a struct

type User struct {
  gorm.Model
  Group uint
  Name uint
}

and by doing DB.Where("group = ?", 1).First(&user) I was running into pq: syntax error near group

Renaming Group to GroupId made it work.

GORM is awesome ;)

Comment From: LonglyCode

This is because the field name uses SQL syntax keywords, not GORM's issue . please close issue .

Comment From: github-actions[bot]

This issue has been automatically marked as stale as it missing playground pull request link, checkout https://github.com/go-gorm/playground for details, it will be closed in 2 days if no further activity occurs.

Comment From: ppd0705

This is because the field name uses SQL syntax keywords, not GORM's issue . please close issue .

Is there any way to solve this problem if the column can't change name?

Comment From: ppd0705

This is because the field name uses SQL syntax keywords, not GORM's issue . please close issue .

Is there any way to solve this problem if the column can't change name?

I found one way: DB.Raw("SELECT * FROM `table_name` WHERE `keyword` = ?", value).Rows()