squirrel icon indicating copy to clipboard operation
squirrel copied to clipboard

Syntax Error with `squirrel.Or` in Postgres

Open maxlambrecht opened this issue 2 years ago • 0 comments

Problem

I have encountered a syntax error when using the squirrel.Or construct with Postgres:

squirrel.Or{
	squirrel.Eq{"field_1": value},
	squirrel.Eq{"field_2": value},
}

The following error occurs: "ERROR: syntax error at or near 'OR' (SQLSTATE 42601)"

Workaround:

squirrel.Or{
	squirrel.Expr("field_1 = $1 OR field_2 = $2", value, value),
}

Additional Information:

Postgres version: 15 Squirrel version: v1.5.4

maxlambrecht avatar Jun 04 '23 15:06 maxlambrecht