uuid values as parameters

Поиск
Список
Период
Сортировка
От vtkstef
Тема uuid values as parameters
Дата
Msg-id 6922363a-ac17-49da-a5bd-ac5d03653dde@x42g2000yqx.googlegroups.com
обсуждение исходный текст
Ответы Re: uuid values as parameters
Список pgsql-jdbc
Hi,

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-
a965-1f4648475589'

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-
a965-1f4648475589')

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

Ciao
Stefano

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Toni Helenius
Дата:
Сообщение: Re: TEXT columns should indentify as java.sql.Types.CLOB
Следующее
От: Lew
Дата:
Сообщение: Re: uuid values as parameters