3

I am trying understand why this is a syntax error:

SELECT distinct precinct FROM ballots
WHERE code_string = ANY (
  { '20000420300098', '20001240300074'})

While this succeeds?

SELECT distinct precinct FROM ballots
WHERE code_string = ANY (
  ARRAY[ '20000420300098', '20001240300074'])

According to https://www.postgresql.org/docs/9.1/static/arrays.html they should be equivalent.

1 Answer 1

8

Curly braces are used in the text representation of arrays.

SELECT distinct precinct FROM ballots
WHERE code_string = ANY (
  '{20000420300098,20001240300074}')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.