Open senz opened 10 years ago
I'm not that familiar with the pgsql libraries. Is there a native quoting function that could be used?
http://www.php.net/manual/ru/function.pg-escape-identifier.php Unfortunally it must use resource of connection
Also PDO has this http://www.php.net/manual/en/pdo.quote.php But it is not suitable for identifiers, only literals. So no luck.
postgres doesn't require quotes. Just using the quoteIdentifier (for postgres this is ") function already defined as part of the PgsqlUtil class should suffice.
Quoted identifier is a special case http://www.postgresql.org/docs/9.1/static/sql-syntax-lexical.html. And it is handled different from unquoted (case sensitive, i.e.). Basic function does not support fully qualified identifiers, and unquoted identifier cannot start with digit (quoted can). I agree that pg-specific func must fully support lexical rules for pg, i will try to implement solution for this.
So here is patch that returns original behavior but treats already quoted identifiers specially (passing thru). And some tests.
Quoting table name identifier db-specific. Handling of fully qualified identifiers.