Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id C1F1E1337BD9 for ; Thu, 24 Mar 2011 10:13:32 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 56890-01-5 for ; Thu, 24 Mar 2011 13:13:24 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mail.postgresql.org (Postfix) with ESMTP id 543D41337BD4 for ; Thu, 24 Mar 2011 10:13:12 -0300 (ADT) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Q2kLg-00016D-J1 for pgsql-jdbc@postgresql.org; Thu, 24 Mar 2011 14:13:12 +0100 Received: from 80.150.102.194 ([80.150.102.194]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 24 Mar 2011 14:13:12 +0100 Received: from spam_eater by 80.150.102.194 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 24 Mar 2011 14:13:12 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-jdbc@postgresql.org From: Thomas Kellerer Subject: How to retrieve column names for tables with underscores Date: Thu, 24 Mar 2011 14:12:58 +0100 Lines: 17 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 80.150.102.194 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.735 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_NUMERIC_HELO=1.164, T_RP_MATCHES_RCVD=-0.01, T_TO_NO_BRKTS_FREEMAIL=0.01 X-Spam-Level: X-Archive-Number: 201103/42 X-Sequence-Number: 21597 Hi, this is probably more of a generic JDBC question, but since I'm trying to solve this with Postgres I'm posting it here: I have two tables table1_ (yes there is an underscore at the end) table12 Now when I try to retrieve the columns for "table_" the columns of table12 are also returned because the table name parameter for DatabaseMetaData.getColumns() is used as a LIKE expression. Is there a way (preferrably standard JDBC) to avoid the LIKE evaluation with the getColumns() call e.g. by specifying an escape character?. I tried to replace the underscore with the standard backslash escape ("table1\_") but that didn't work. Or is the only reliable way to check the value of the returned TABLE_NAME whether it matches my input value? Thanks Thomas