Re: CAST function for user defined type

Поиск
Список
Период
Сортировка
От Ron Peterson
Тема Re: CAST function for user defined type
Дата
Msg-id 20070122164946.GB19861@yellowbank.com
обсуждение исходный текст
Ответ на Re: CAST function for user defined type  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On Mon, Jan 22, 2007 at 11:40:08AM -0500, Tom Lane wrote:
> Ron Peterson <ron.peterson@yellowbank.com> writes:
> > That cleared one hurdle, but I'm still not there yet.
>
> > % select 'fe43d07c0c624786bebfcb3357a2a13a'::y_octet_16;
> >             y_octet_16
> > ----------------------------------
> >  fe43d07c0c624786bebfcb3357a2a13a
>
> That's not invoking any cast function, but the type's typinput function
> (applied to a C-string).
>
> > When things are connected up this way,
> > what should the cast function expect to see as input?
>
> > % select encode( y_uuid_generate(), 'hex' )::y_octet_16;
> > ERROR:  input string contains invalid characters
>
> If it's a cast from TEXT, it'll get the internal form of a TEXT datum,
> ie, a counted (and not null-terminated) string.  You might look at
> textin() and textout() to grok the difference.

Got it working now.  Thanks.

--
Ron Peterson
https://www.yellowbank.com/

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

Предыдущее
От: "Moritz Bayer"
Дата:
Сообщение: Loop in loop
Следующее
От: Kevin Murphy
Дата:
Сообщение: selecting random rows