Re: (How to) Make SQLData of UUID?

From: Alexander Myodov <amyodov(at)gmail(dot)com>
To: Basil Bourque <basil(dot)bourque(at)gmail(dot)com>
Cc: pgsql-jdbc(at)lists(dot)postgresql(dot)org
Subject: Re: (How to) Make SQLData of UUID?
Date: 2019-07-21 23:43:20
Message-ID: CAHF95JwePa0h38KsWRm-jTbQAdKcbjRrGAQuzHK1JSG8u9guOQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Not so much, sorry :(

The problem is not in making a PL/PgSQL function returning an UUID. Or even
returning a custom type containing an UUID (like MYFUNC_RETURN_TYPE in my
case). The problem is on Java level, when I need to make a Java
handler/mapping of PostgreSQL custom type (which contains an UUID
internally).

For now I, instead of out.writeObject, made it through
out.writeString(key.toString()), but I am very unsure if this is how it
should be done. And if the opposite way, key = (UUID) in.readObject() is
also safe.

пн, 22 июл. 2019 г. в 02:09, Basil Bourque <basil(dot)bourque(at)gmail(dot)com>:

> Any hints please?
>
>
> Does this Answer by Gopinagh.R on Stack Overflow help?
>
> https://stackoverflow.com/a/14197445/642706
>
> CREATE OR REPLACE FUNCTION generatesurrogat() RETURNS uuid AS$BODY$DECLARE
> uid UUID;BEGIN
> uid:=(select uuid_generate_v1());
> RAISE NOTICE 'My UUID is %',uid;return uid;END$BODY$
> LANGUAGE plpgsql VOLATILE
> COST 100;
>
>
>
> —BB
>

--
Alex Myodov

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Thomas Kellerer 2019-07-22 06:22:16 Re: (How to) Make SQLData of UUID?
Previous Message Basil Bourque 2019-07-21 23:08:58 Re: (How to) Make SQLData of UUID?