Background
orm:go-pg
Execute whereIn error: Error #42601} syntax} error at} or “near”)
As shown in the figure
The query is as follows:
err = db.Model(&model.Abc{}).WhereIn(“id in (?)”, ids).Column(“id”).Column(“name”).Select(&records)
If IDS is an empty slice, this error will be reported at this time
Solution:
The slices passed in should not be empty. From the business point of view, the length of the list of condition ids to be checked is 0 then the results must not be checked, so you can make a judgment in the outer layer, ids length is 0 then do not take the sql query can be.
Read More:
- [Solved] ORA-21525: attribute number or (collection element at index) string violated its constraints
- Template cannot be rendered due to the joint query of populate in mongoose: syntax error: unexpected token r in JSON at position 0
- [Solved] Laravel Create Data Table Error: Syntax error or access violation: 1071 Specified key was too long
- Quartus compile error: Error (10170): Verilog HDL syntax error at Verilog1.v(8)
- [Solved] pagehelper Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘LIMIT 1’
- [Solved] .\main.go:3:6: missing function body .\main.go:4:1: syntax error: unexpected semicolon or newline be
- ‘pre-mature EOF‘ : syntax error syntax error [How to Solve]
- Mybatis Error: Cause: java.sql.SQLException: sql injection violation, syntax error: syntax error, expect EQ
- OpenCV(-206:Bad flag (parameter or structure field)) Unrecognized or unsupported array type [How to Solve]
- Vscode uses /deep/ Syntax error [How to Solve]
- file_name.sh: 3: Syntax error: “(“ unexpected [How to Solve]
- [Solved] PCH Warning: header stop not at file scope
- [Solved] PhoenixParserException:ERROR 602 (42P00): Syntax error. Missing ‘EOF’
- line 1: syntax error: unexpected “(“ [How to Solve]
- [Solved] TypeError: Cannot read property ‘indexOf‘ of undefined at VueComponent.resetFields
- Tensorflow Run Error or the interface is stuck or report error: Could not create cudnn handle: CUDNN_STATUS_INTERNAL_ERROR
- [Solved] Access to XMLHttpRequest at ‘http://127.0.0.1:5000/markdownlang/‘ from origin ‘null‘ has been bl
- [Solved] Error: Failed at the [email protected] install script.
- [Solved] ZYNQ Programs Error: memory write error at 0x100000.APB AP transaction error,DAP status f0000021
- [Solved] MATLAB and pycharm open error messages at the same time