我有一个传统的PostgreSql表,其中包含具有多个值的列。我想选择包含搜索中任何值的行。
-- Example query select * from stuff where ARRAY['Value A', 'Value X'] && regexp_split_to_array(thing, '\|');
我可以从Grails 2.5.1 GORM 4生成这种类型的where条件吗。x条件查询?
仅供参考:我已经看到了“Grails Postgresql扩展插件”,但目前无法更改我的列定义。
您可以使用 sqlRestriction 在条件中添加任意SQL条件。在 bottom of the node reference for createCriteria() 。
sqlRestriction
createCriteria()
Stuff.withCriteria { sqlRestriction "ARRAY['Value A', 'Value X'] && regexp_split_to_array(thing, '\|')" }