> Depends on how you define "correctly" ;-)
> Chances are that it will raise an error.
>
> I'm not sure if this should really be considered a problem; that's a
> really obtuse SQL statement. As a non-pgsqler, I have a hard time
> figuring out where the variables are.
Well, anything that's not perfect is a problem :)
Dollar quoting is new in pgsql 8, it's sort of like 'heredocs'.
Basically it's to avoid having to escape ' in your function bodies, or
other strings, eg:
CREATE FUNCTION test(int) RETURNS int AS
$tagname$
SELECT 23 FROM table WHERE a > $1 AND b = 'hello'
$tagname$ LANGUAGE SQL;
The 'tagname' is the dollar quote identifier, and everything from that
dollar quote opener to the end one will be considered a string literal.
Notice I do not have to escape the '' in the function body.
It a perfectly reasonable thing, even encouraged thing to do. We'll
just have to upgrade the SQL parser to cope :P
Prepared query parameters are indicated with $n syntax in PostgreSQL,
just to make things tricky :D
ie:
SELECT * FROM blah WHERE a = $1 AND b = $2;
The $1 will get replaced with first param, $2 with second, etc.
Maybe support should be added for this style of notation? It'd be
pretty easy I guess.
> I welcome native postgres prepare/bind/execute support, and don't mind
> adjusting the pdo_sql_parser.re code to cater for rewriting ? or
> :named style substitutions into postgres style; it already includes
> some logic for rewriting ? to :named and vice-versa, so the
> modifications should be reasonably simple.
Might be necessary.
Chris