Re: Type cast text to int4

Поиск
Список
Период
Сортировка
От M. van Egmond
Тема Re: Type cast text to int4
Дата
Msg-id 46E138C9.7060702@quetalzorg.nl
обсуждение исходный текст
Ответ на Re: Type cast text to int4  (Martijn van Oosterhout <kleptog@svana.org>)
Ответы Re: Type cast text to int4  (Martijn van Oosterhout <kleptog@svana.org>)
Список pgsql-general
Could you please give me the correct syntax to create a basetype using
pl/pgsql functions instead of external functions?
Or is this impossible?

Thanks.

Martijn van Oosterhout schreef:
> On Fri, Sep 07, 2007 at 11:36:23AM +0200, M. van Egmond wrote:
>
>> Hello everybody,
>>
>> Im having troubles overriding postgresql's default behaviour of throwing
>> an error while trying to cast an empty string to int4. I would like to
>> cast empty strings to a null integer value. I've tried this by creating
>> my own domain:
>>
>
> Your problem is that ''::myint does not call your cast function, it
> calls the input function for your basetype, which a domain can't
> override. Your options are to actually make a new basetype, which isn't
> too hard. Or, you can use ''::text::myint which probably will call your
> cast function.
>
> Have a nice day,
>

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

Предыдущее
От: "Max Zorloff"
Дата:
Сообщение: Re: Connection pooling
Следующее
От: Christian Schröder
Дата:
Сообщение: Query with "like" is really slow