Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id C1D959FB7D6 for ; Sun, 4 Mar 2007 15:01:43 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 51598-03 for ; Sun, 4 Mar 2007 15:01:43 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 24AE39FB286 for ; Sun, 4 Mar 2007 15:01:38 -0400 (AST) Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [65.19.161.25]) by wwwmaster.postgresql.org (8.13.3/8.13.3) with ESMTP id l24J0DEV034468 for ; Sun, 4 Mar 2007 19:00:23 GMT (envelope-from www@wwwmaster.postgresql.org) Received: (from www@localhost) by wwwmaster.postgresql.org (8.13.3/8.13.3/Submit) id l24J08aR034467; Sun, 4 Mar 2007 19:00:08 GMT (envelope-from www) Date: Sun, 4 Mar 2007 19:00:08 GMT Message-Id: <200703041900.l24J08aR034467@wwwmaster.postgresql.org> To: pgsql-bugs@postgresql.org Subject: BUG #3106: A problem with escaping table name pattern for DatabaseMetaData.getColumns() From: "Valery Meshkov" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/31 X-Sequence-Number: 17045 The following bug has been logged online: Bug reference: 3106 Logged by: Valery Meshkov Email address: meshok2001-news@yahoo.com PostgreSQL version: 8.2.3 Operating system: Windows Description: A problem with escaping table name pattern for DatabaseMetaData.getColumns() Details: I am seeing a problem in the JDBC driver postgresql-8.2-504.jdbc3.jar with getting columns of the table 'A_B'. I am escaping '_' with the escape value returned by DatabaseMetaData.getSearchStringEscape(), which in my case is "\\\\" (standard_conforming_strings is off). When I pass the resulting table name 'A\\_B' to DatabaseMetaData.getColumns() the number of backslashes doubles again, resulting in 4 backslashes in the select statement: SELECT n.nspname,c.relname,a.attname,a.atttypid,a.attnotnull,a.atttypmod, a.attlen,a.attnum,def.adsrc,dsc.description FROM pg_catalog.pg_namespace n JOIN pg_catalog.pg_class c ON (c.relnamespace = n.oid) JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND a.attnum = def.adnum) LEFT JOIN pg_catalog.pg_description dsc ON (c.oid=dsc.objoid AND a.attnum = dsc.objsubid) LEFT JOIN pg_catalog.pg_class dc ON (dc.oid=dsc.classoid AND dc.relname='pg_class') LEFT JOIN pg_catalog.pg_namespace dn ON (dc.relnamespace=dn.oid AND dn.nspname='pg_catalog') WHERE a.attnum > 0 AND NOT a.attisdropped AND c.relname LIKE 'A\\\\_B' ORDER BY nspname,relname,attnum With this select no columns are found. If I change the escape string in the debugger to have just one backslash ("\\") everything works fine. It is also working with the 8.1-404 driver.