Skip site navigation (1) Skip section navigation (2)

uuid values as parameters

From: vtkstef <vtkstef(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: uuid values as parameters
Date: 2010-08-19 16:10:01
Message-ID: (view raw or whole thread)
Lists: pgsql-jdbc

I have a simple table foo with a column guid of data type uuid

if I execute the following query

select  guid from foo where guid = '849b3d72-1400-44f1-

the query returns fine

but if I parameterize the query as this

select guid from foo where guid = ?

and I set the the parameter using setString(1, '849b3d72-1400-44f1-

the query bombs with the following:

 [Error Code: 0, SQL State: 42883]  ERROR: operator does not exist:
uuid = character varying

I understand I need to use setObject(), or that I could explicitly
cast it (select guid from foo where guid = ?::uuid)  but I don't
understand why harcoding a string works, and sending a string
parameter does not



pgsql-jdbc by date

Next:From: LewDate: 2010-08-22 15:38:36
Subject: Re: uuid values as parameters
Previous:From: Toni HeleniusDate: 2010-08-18 09:01:59
Subject: Re: TEXT columns should indentify as java.sql.Types.CLOB

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group