Re: Insert NULL for ''

Поиск
Список
Период
Сортировка
От Mike Mascari
Тема Re: Insert NULL for ''
Дата
Msg-id 3EEB37E4.8010103@mascari.com
обсуждение исходный текст
Ответ на Re: Insert NULL for ''  (Tino Wildenhain <tino@wildenhain.de>)
Список pgsql-general
Tino Wildenhain wrote:

> Hi,
>
>
> Mike Mascari wrote:
> ...
>
>> What would be really neat is the ability of CREATE CAST to override
>> the default implementation and at the same time let the override call
>> the "base" implementation, if necessary.
>
> This is already possible: you just have to define your own
> type which would behave like a date for all operations
> but not for text2yourdate, which would then accept ''
> for null as well.
>
> Might be a little bit work, buts perfectly doable.

Sure, but client applications, such as ODBC, which understand the SQL
data types won't be able to handle your custom type. And Daniel would
have to modify the schema to use a custom type. I was thinking that
the casting function is called by the database when it gets a string
literal as a text type, but, from reading Tom's response, I guess that
is not the case. If it did, it would have been nice for Daniel to just
override the casting function to handle the NULL mapping of '' for the
DATE datatype. It would also be useful in allowing for customization
of text mappings for the number types as well.

Mike Mascari
mascarm@mascari.com


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

Предыдущее
От: Tino Wildenhain
Дата:
Сообщение: Re: Insert NULL for ''
Следующее
От: "Jim C. Nasby"
Дата:
Сообщение: Re: Index not being used in MAX function (7.2.3)