Re: VARIANT / ANYTYPE datatype

From: Eric McKeeth <eldin00(at)gmail(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: VARIANT / ANYTYPE datatype
Date: 2011-05-10 22:21:36
Message-ID: BANLkTimpiFyf9kLDrfNFMpAXZVL5_4v80Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 10, 2011 at 3:57 PM, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:

> On Wed, May 4, 2011 at 5:58 PM, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
> wrote:
>
> > A customer came to us with this request: a way to store "any" data in a
> > column. We've gone back and forth trying to determine reasonable
> > implementation restrictions, safety and useful semantics for them.
> > I note that this has been requested in the past:
> > http://archives.postgresql.org/pgsql-general/2004-02/msg01266.php
>
> I think its a reasonably common use case.
>
> Would it be possible to do this with a "typed" hstore? Seems easier to
> add something there than it would be to add the VARIANT type as
> discussed here.
>
>
> > both Oracle and MS-SQL have it
>
> Do they? What types are they called?
>
> --
> Simon Riggs http://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Training & Services
>
>
MS SQL Server calls it's variant type 'sql_variant', but it's limited to a
subset of the data types they support. Basically, it can store any numeric
type, or any binary or text type with a constrained length. No timestamps,
geometry, XML, user-defined types, etc. allowed. So it's not really as much
of an "any value" type as it might look on the surface. Don't know any
details of Oracle's implementation.

-Eric

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2011-05-10 22:24:34 Re: the big picture for index-only scans
Previous Message Tom Lane 2011-05-10 22:05:43 Re: Backpatching of "Teach the regular expression functions to do case-insensitive matching"