X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 8648B9F9CEE for ; Tue, 16 May 2006 05:50:29 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 00714-01 for ; Tue, 16 May 2006 05:50:19 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail63.csoft.net (mail63.csoft.net [205.205.214.4]) by postgresql.org (Postfix) with SMTP id 3563A9F944D for ; Tue, 16 May 2006 05:50:17 -0300 (ADT) Received: (qmail 890 invoked by uid 1112); 16 May 2006 08:50:16 -0000 Date: Tue, 16 May 2006 03:50:16 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary2.csoft.net To: Andy Jefferson cc: pgsql-jdbc@postgresql.org Subject: Re: JPOX Types.CHAR error In-Reply-To: <200605160908.05250.andy@jpox.org> Message-ID: References: <200605160908.05250.andy@jpox.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/52 X-Sequence-Number: 15180 On Tue, 16 May 2006, Andy Jefferson wrote: >> A quick check reveals nothing obviously wrong with how >> DatabaseMetaData.getTypeInfo returns data for Types.CHAR. > > Well that depends on your point of view ;-) > PSQL 8.1-405 JDBC driver now returns SQL type "char" as Types.OTHER (instead > of Types.CHAR), and returns "bpchar" as Types.CHAR. Since PSQL has always > supported "char" as Types.CHAR (since it kinda seems reasonable), JPOX uses > that as the default ... and it is no longer there (yet is in PSQL 8.0). I can > set up JPOX to fake this type for users so they see no change but it would > make more sense (to me) to have the JDBC driver return consistent with > previous incarnations. Maybe there was a good reason why "char" is no longer > Types.CHAR ? > I'm not sure there's a good reason that "char" isn't returned as Types.CHAR, but you definitely want to be using bpchar as the default mapping for Types.CHAR. The type "char" is a single byte datatype that is really only used for internal system catalogs and is not to be confused with char(N). One of the bugs you're probably seeing is that the postgresql jdbc driver does not return the results of DatabaseMetaData.getTypeInfo sorted according to the javadoc spec of closest match, but instead returns data in random order. jurka=# create table chartest (a "char", b char, c char(5)); CREATE TABLE jurka=# \d chartest Table "public.chartest" Column | Type | Modifiers --------+--------------+----------- a | "char" | b | character(1) | c | character(5) | jurka=# select a.attname,t.typname FROM pg_attribute a, pg_type t where a.atttypid = t.oid and a.attrelid = 'chartest'::regclass::oid and a.attnum > 0; attname | typname ---------+--------- a | char c | bpchar b | bpchar (3 rows) Kris Jurka