Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id D281A632C1D for ; Fri, 21 May 2010 19:16:12 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 04163-01 for ; Fri, 21 May 2010 22:16:04 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail63.csoft.net (mail63.csoft.net [205.205.214.4]) by mail.postgresql.org (Postfix) with ESMTP id AC159632AAA for ; Fri, 21 May 2010 19:16:05 -0300 (ADT) Received: from mail63.csoft.net (localhost [127.0.0.1]) by mail63.csoft.net (Postfix) with ESMTP id 6190728411; Fri, 21 May 2010 18:16:03 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=csoft.net; h=date:from:to :cc:subject:in-reply-to:message-id:references:mime-version :content-type; s=sel1; bh=rnROa9zlJ4hEm15+/jtbC+FoqBk=; b=uDWPMr KZSa04xxxPlph3EWdPmRhRaIby8oO1tlGHLTR4oiCfq4vuIF6fnkMzPIWrA+pS4F TyPcNdnnntIkIeqnfyS+Ej65pHBKWNw1kHFsZqM5J7jfOAQCtoJOnRq2wQP8QZNq MuueboBKPsbkAotjYvybO0V+eaV6wUjhV53WQ= Received: from leary.csoft.net (leary.csoft.net [205.205.214.5]) by mail63.csoft.net (Postfix) with ESMTP id 5258C28403; Fri, 21 May 2010 18:16:03 -0400 (EDT) Received: by leary.csoft.net (Postfix, from userid 1112) id 15FACA2FC; Fri, 21 May 2010 18:16:02 -0400 (EDT) Date: Fri, 21 May 2010 18:16:02 -0400 (EDT) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: =?KOI8-U?B?96bUwcymyiD0yc3eydvJzg==?= cc: PG-JDBC Mailing List Subject: Re: Using java.lang.Character for "char" data type In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (BSO 1167 2008-08-23) 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: Content-Type: TEXT/PLAIN; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE X-Archive-Number: 201005/59 X-Sequence-Number: 20543 On Fri, 21 May 2010, ??????? ???????? wrote: > I've tried to use Character to fill "char" column, e.g. like in the next > test: > ----- > con.createStatement().execute("create table tst(tcol \"char\")"); > PreparedStatement stmt =3D con.prepareStatement("insert into tst(tcol) > values(?)"); > stmt.setObject(1, 'c'); > stmt..executeUpdate(); > ----- > and got=A0 > Exception in thread "main" org.postgresql.util.PSQLException: Can't infer > the SQL type to use for an instance of java.lang.Character. Use setObject= () > with an explicit Types value to specify the type to use. atorg.postgresql= .jdbc2.AbstractJdbc2Statement.setObject(AbstractJdbc2Statemen > t.java:1740) >=20 > with 8.3-603.jdbc4 driver. > May be it would be reasonable to treat Character like String of size 1? > It would be possible to support setObject for a Character, but be aware=20 that "char" is not a character long, it's a byte long, so it will fail on= =20 multibyte characters. Kris Jurka=