From: | Decibel! <decibel(at)decibel(dot)org> |
---|---|
To: | Gregory Stark <stark(at)enterprisedb(dot)com> |
Cc: | <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: Oddities with ANYARRAY |
Date: | 2007-08-01 16:15:47 |
Message-ID: | BACB21D7-0B46-471E-B608-31A25DA87EA1@decibel.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Jul 31, 2007, at 11:55 PM, Gregory Stark wrote:
> "Decibel!" <decibel(at)decibel(dot)org> writes:
>
>> David Fetter and I were just looking at something on IRC...
>>
>> decibel=# select most_common_vals[1] from pg_stats where
>> tablename='pg_depend' and attname='classid';
>> ERROR: cannot subscript type anyarray because it is not an array
>> decibel=# select most_common_freqs[1] from pg_stats where
>> tablename='pg_depend' and attname='classid';
>> most_common_freqs
>> -------------------
>> 0.566
>> (1 row)
>>
>> ISTM you'd want to be able to reference an individual element of an
>> ANYARRAY... but this gets even more odd...
>
> And what type would the result be?
ANYELEMENT? I know that'd still have to be casted to something normal
eventually; do we have support for that?
> But this is an odd coincidence as I was just looking at this myself
> to do
> those histogram charts I was talking about. The solution I was
> going to
> propose was to allow casting from anyarray to a normal array, then
> allow
> subscripting the normal array.
>
> I would be fine requiring the cast to be to the correct array type
> with a
> run-time error if the type doesn't match. Or it could use the VIAIO
> cast which
> would work as long as the input format matched. So you could always
> cast to
> text[] even if it was an integer[] or something else originally.
I'd expected that the 'ANY' types had additional information
somewhere that told them what the original data type actually was,
but I guess that's not the case. Maybe it'd be worth adding?
--
Decibel!, aka Jim Nasby decibel(at)decibel(dot)org
EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)
From | Date | Subject | |
---|---|---|---|
Next Message | Justin Hibbits | 2007-08-01 17:42:02 | BUG #3503: Benchmark scripts broken |
Previous Message | Gregory Stark | 2007-08-01 06:55:03 | Re: Oddities with ANYARRAY |