Re: VARIANT / ANYTYPE datatype

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: VARIANT / ANYTYPE datatype
Дата
Msg-id BANLkTinTr7Go5dusFH_6HRMu66tdZ-MxpA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: VARIANT / ANYTYPE datatype  (Joseph Adams <joeyadams3.14159@gmail.com>)
Ответы Re: VARIANT / ANYTYPE datatype
Список pgsql-hackers
On Wed, May 11, 2011 at 11:43 AM, Joseph Adams
<joeyadams3.14159@gmail.com> wrote:
> On Tue, May 10, 2011 at 5:19 PM, Darren Duncan <darren@darrenduncan.net> wrote:
>> Examples of open union types could be number, which all the numeric types
>> compose, and so you can know say that you can use the generic numeric
>> operators on values you have simply if their types compose the number union
>> type, and it still works if more numeric types appear later.  Likewise, the
>> string open union could include both text and blob, as both support
>> catenation and substring matches or extraction, for example.
>>
>> This would aid to operator overloading in a generic way, letting you use the
>> same syntax for different types, but allowing types to mix is optional; eg,
>> you could support "add(int,int)" and "add(real,real)" without supporting
>> "add(int,real)" etc but the syntax "add(x,y)" is shared, and you do this
>> while still having a strong type system; allowing the mixing is optional
>> case-by-case.
>
> Coming from a Haskell perspective, this is a great idea, but I don't
> think the "union" feature should be used to implement it.

I'm unclear what the point of such a feature would be.  A union of all
the common numeric types is not much different from the existing type
"numeric".

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: VARIANT / ANYTYPE datatype
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Fix for bug in ldapServiceLookup in libpq