Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 1C54B63014E for ; Wed, 18 Aug 2010 05:15:42 -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 17129-08 for ; Wed, 18 Aug 2010 08:15:34 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from espresso1.syncrontech.com (espresso1.syncrontech.com [213.28.98.34]) by mail.postgresql.org (Postfix) with ESMTP id 20F1B63373D for ; Wed, 18 Aug 2010 05:15:33 -0300 (ADT) Received: from ink.sad.syncrontech.com (ink.syncrontech.com [192.168.2.107]) by espresso1.syncrontech.com (8.14.4/8.14.4) with ESMTP id o7I8FIoS049580; Wed, 18 Aug 2010 11:15:18 +0300 (EEST) (envelope-from Toni.Helenius@syncrontech.com) Received: from ink.sad.syncrontech.com ([192.168.2.107]) by ink.sad.syncrontech.com ([192.168.2.107]) with mapi; Wed, 18 Aug 2010 11:15:13 +0300 From: Toni Helenius To: Oliver Jowett CC: "pgsql-jdbc@postgresql.org" Date: Wed, 18 Aug 2010 11:15:11 +0300 Subject: Re: TEXT columns should indentify as java.sql.Types.CLOB Thread-Topic: [JDBC] TEXT columns should indentify as java.sql.Types.CLOB Thread-Index: Acs+p2tiw34AzIdKTbyKxcbx17e3KAAA+Twg Message-ID: References: <4C695AED.5040806@ttc-cmc.net> <4C6B8C53.3040609@opencloud.com> In-Reply-To: <4C6B8C53.3040609@opencloud.com> Accept-Language: en-US, fi-FI Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US, fi-FI Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201008/60 X-Sequence-Number: 20863 Hi, Here is the best I can do, I'm sure you'll manage to fill in the holes: private static final String DRIVER =3D "org.postgresql.Driver"; private static final String URL =3D "jdbc:postgresql://localhost/testdb"; private static final String USERNAME =3D "root"; private static final String PASSWORD =3D ""; Class.forName("DRIVER"); Connection connection =3D DriverManager.getConnection(URL, USERNAME, PASSWO= RD); DatabaseMetaData metaFrom =3D connection.getMetaData(); // Get the columns ResultSet cols =3D metaFrom.getColumns(null, YOUR_SCHEMA_HERE, YOUR_TABLE_N= AME_HERE, null); // Get column info while (cols.next()) { println("Column name: " + cols.getString("COLUMN_NAME")); short type =3D cols.getShort("DATA_TYPE")); if (java.sql.Types.BOOLEAN =3D=3D type) { println("A boolean"); } else { println("Not a boolean! (" + type + ")"); } println("Postgre calls this: " + cols.getString("TYPE_NAME")); } -----Original Message----- From: Oliver Jowett [mailto:oliver@opencloud.com]=20 Sent: 18. elokuuta 2010 10:32 To: Toni Helenius Cc: pgsql-jdbc@postgresql.org Subject: Re: [JDBC] TEXT columns should indentify as java.sql.Types.CLOB Toni Helenius wrote: > Hi, >=20 > An definitely a bug: BOOLEAN columns get identified as java.sql.Types.VAR= CHAR. Not java.sql.Types.BOOLEAN as they should. I end up getting SQL creat= e statements where boolean fields are translated back as VARCHAR(1). That does sound like a bug. Do you have a self-contained testcase showing the problem? -O