union of types in a different category

Поиск
Список
Период
Сортировка
От James Harper
Тема union of types in a different category
Дата
Msg-id 6035A0D088A63A46850C3988ED045A4B6F3AFC86@BITCOM1.int.sbss.com.au
обсуждение исходный текст
Ответы Re: union of types in a different category  (Brent Wood <Brent.Wood@niwa.co.nz>)
Re: union of types in a different category  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
According to clause 3 on http://www.postgresql.org/docs/9.3/static/typeconv-union-case.html regarding union type
matching:

3. If the non-unknown inputs are not all of the same type category, fail.

So a query "SELECT 1 UNION SELECT 1.1" works because 1 and 1.1 are of the same category, and one type has an implicit
castto the other, but the query "SELECT '1' UNION SELECT 2" fails because '1' is a string literal and 2 is a number and
sothey are different categories. Right? 

Is this an artificial limitation of postgres or is there an underlying technical reason for this behaviour? For my
purposesit would be better if the restriction was removed and that the union would work as long as there was an
implicitcast that allowed conversion of all fields to the same type.  

MSSQL doesn't have this restriction and I'd prefer if I didn't have to rewrite these queries (or create a complete set
ofmssql compatible types in the same category) when porting applications. 

Thanks

James


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

Предыдущее
От: alexandros_e
Дата:
Сообщение: pg_trgm extension and theory
Следующее
От: James Harper
Дата:
Сообщение: Re: union of types in a different category