Re: DOMAINs and CASTs

Поиск
Список
Период
Сортировка
От Darren Duncan
Тема Re: DOMAINs and CASTs
Дата
Msg-id 4DCF3092.5030601@darrenduncan.net
обсуждение исходный текст
Ответ на Re: DOMAINs and CASTs  (Darren Duncan <darren@darrenduncan.net>)
Ответы Re: DOMAINs and CASTs
Список pgsql-hackers
Darren Duncan wrote:
> I think it would be best that the generic cast syntax only be useable 
> for casts defined on the base type, and if you want a domain-specific 
> one you should use the function syntax such as your datetime2int().
> 
> That way it is easier for users to predict what behavior will occur, and 
> implementation will be easier too.

Replying to myself, I offer another alternative:

What you ask for is indeed supported, but that if for a given input value more 
than one cast applies to it, particularly for 2 overlapping domains, then which 
cast is invoked is undefined, so for example the DBMS may just use the first one 
it finds.

It is then up to the user to ensure that when they define casts over domains 
that they just define ones that either produce the same outputs for the same 
overlapping inputs (the best answer) or they ensure that they don't overlap in 
their input domains.

-- Darren Duncan


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