Blake Brown
Blake Brown

Reputation: 143

Strange Golang SQL Error - WHERE Clause

I am running a query in Golang, using the sqlx library:

rows, dbErr := db.Queryx(`
    SELECT *
    FROM table_a as a
       INNER JOIN table_b AS b
          ON a.b_id = b.id
       WHERE b.id = 'b3c06feb-8bd1-42e1-b516-c1121990ff81';
    `)

The query is syntactically correct, and runs fine in Postico, terminal, etc. However when I try to run this query in Golang I get the error pq: syntax error at or near "  WHERE"

Can anyone explain this strange behaviour?

Upvotes: 0

Views: 281

Answers (1)

Blake Brown
Blake Brown

Reputation: 143

The issue was outdated dependencies. We had to update our Golang sql libraries.

Thank you to everyone who submitted suggestions.

Upvotes: 1

Related Questions