Re: VARIANT / ANYTYPE datatype

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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-04 19:55:03
Message-ID: 4DC1AF17.8020701@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 05/04/2011 01:36 PM, Tom Lane wrote:
>
>> The main idea is to be able to store column values in an audit table
>> like this:
>> old_value variant
>> new_value variant
>> Currently, they use text for old_value and new_value, but this is, of
>> course, not very satisfactory.
> Just out of curiosity, what actual functionality gain would ensue over
> just using text? It seems like doing anything useful with the audit
> table contents would still require casting the column to text, or the
> moral equivalent of that.
>

Yeah, I've been down this road once or twice, and I think that's the $64
question.

I wrote a custom audit app two or three years ago. After several
iterations the customer and I found that using an hstore for the old/new
(or old record / changeset, which is what we actually use) was the most
suitable for our use.

I think if we did this we'd need to add some sort of is_type() and
typeof() functions for variant objects.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-05-04 19:58:06 Re: Predicate locking
Previous Message Scott Marlowe 2011-05-04 19:50:50 Re: 'SGT DETAIL: Could not open file "pg_clog/05DC": No such file or directory' - what to do now?