phactory icon indicating copy to clipboard operation
phactory copied to clipboard

Fix for quoting table names. Pg fully qualified ids fix.

Open senz opened this issue 12 years ago • 6 comments

Quoting table name identifier db-specific. Handling of fully qualified identifiers.

senz avatar Nov 08 '13 14:11 senz

I'm not that familiar with the pgsql libraries. Is there a native quoting function that could be used?

jimbojsb avatar Nov 08 '13 15:11 jimbojsb

http://www.php.net/manual/ru/function.pg-escape-identifier.php Unfortunally it must use resource of connection

senz avatar Nov 08 '13 15:11 senz

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.

senz avatar Nov 08 '13 15:11 senz

postgres doesn't require quotes. Just using the quoteIdentifier (for postgres this is ") function already defined as part of the PgsqlUtil class should suffice.

cank avatar Nov 21 '13 16:11 cank

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.

senz avatar Nov 24 '13 08:11 senz

So here is patch that returns original behavior but treats already quoted identifiers specially (passing thru). And some tests.

senz avatar Nov 25 '13 21:11 senz