Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 4B6F66334FA for ; Tue, 3 Mar 2009 17:08:04 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 69833-08 for ; Tue, 3 Mar 2009 17:08:00 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by mail.postgresql.org (Postfix) with ESMTP id 66C0C63339A for ; Tue, 3 Mar 2009 17:07:59 -0400 (AST) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1LebqB-0005GA-S1 for pgsql-jdbc@postgresql.org; Tue, 03 Mar 2009 21:07:51 +0000 Received: from ppp-93-104-79-251.dynamic.mnet-online.de ([93.104.79.251]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 03 Mar 2009 21:07:51 +0000 Received: from spam_eater by ppp-93-104-79-251.dynamic.mnet-online.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 03 Mar 2009 21:07:51 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-jdbc@postgresql.org From: Thomas Kellerer Subject: Inserting into a uuid column Date: Tue, 03 Mar 2009 22:07:38 +0100 Lines: 34 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: ppp-93-104-79-251.dynamic.mnet-online.de User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.12) Gecko/20080213 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200903/9 X-Sequence-Number: 19339 Hi, I have a table with a column of type UUID and I would like to import data into that table. I'm using a Java based import tool that will use a PreparedStatement and setObject() (passing a String variable) to insert the data. The problem is that the import does not work because Postgres throws an error: "ERROR: column "guid" is of type uuid but expression is of type character varying" What I don't understand is that doing an insert with a character literal: INSERT INTO my_table (guid_column, ...) VALUES ('a0eebc999c0b4ef8bb6d6bb9bd380a11', ...) works without problems also when used from within Java. But the following Java code will throw the above error: PrparedStatement stmt = connection.prepareStatement( "insert into my_table (guid_column) values (?)"); stmt.setObject(1, "a0eebc999c0b4ef8bb6d6bb9bd380a11"); stmt.executeUpdate(); To me this sounds like a problem with the JDBC driver, or am I missing something? I'm using PG 8.3.5 on Windows XP, the driver is postgresql-8.3-603.jdbc3.jar Regards Thomas