Aura.Sql icon indicating copy to clipboard operation
Aura.Sql copied to clipboard

Bug with pgsql query

Open chekalsky opened this issue 6 years ago • 5 comments

If you will try to do this:

$pdo->fetchCol("SELECT id FROM table WHERE removed = false AND data @> '{\"is_hidden\":false}'::jsonb AND type in (:types)", ['types' => [1, 2]]);

you will get an error from DB: SQLSTATE[08P01]: <<Unknown error>>: 7 ERROR: bind message supplies 0 parameters, but prepared statement "pdo_stmt_00000001" requires 1

And this is because :types will be skipped here.

chekalsky avatar Sep 06 '18 23:09 chekalsky

Anybody?

chekalsky avatar Sep 21 '18 21:09 chekalsky

@pmjones is Aura.SQL abandoned?

chekalsky avatar Feb 18 '19 17:02 chekalsky

Which version are you trying this with: v2, or v3?

pmjones avatar Feb 19 '19 06:02 pmjones

v3

chekalsky avatar Mar 04 '19 19:03 chekalsky

@chekalsky sorry for being late here. I actually added a failing test.

The fun fact is if you change the order

SELECT * FROM table WHERE type in (:types) AND removed = false AND data @> '{\"is_hidden\":false}'::jsonb

this will work.

I don't have a fix right now. But can look into it at some point of time.

harikt avatar Feb 28 '22 12:02 harikt