From: | "Merlin Moncure" <mmoncure(at)gmail(dot)com> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "Randall Lucas" <rlucas(at)tercent(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Coercing compound types to use generic ROW comparison operators |
Date: | 2007-10-12 16:00:46 |
Message-ID: | b42b73150710120900n7db28422k356a8c3cb25f24f3@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 10/12/07, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> "Merlin Moncure" <mmoncure(at)gmail(dot)com> writes:
> > AIUI, the biggest problem with the current behavior is that there is
> > no way to usefully index composite types, it looks like
>
> > create index bar_idx on bar(f);
> > create index bar_idx on bar((f).*);
> > create index bar_idx on bar((f).a, (f).b);
>
> The last case works, you just don't have enough parentheses.
>
> regression=# create type mytype as (a int, b float);
> CREATE TYPE
> regression=# create table foo(f mytype);
> CREATE TABLE
> regression=# create index fooi on foo(((f).a), ((f).b));
> CREATE INDEX
wow, thats pretty neat! (although:
create index fooi on foo(((f).a));
feels awfully weird).
for the record, creating indexes this way works fully with row
comparison strategies (in 8.2+):
select * from foo where ((f).a, (f).b) > (5, 0.6) order by (f).a, (f).b limit 1;
will use the 'fooi' index above.
merlin
From | Date | Subject | |
---|---|---|---|
Next Message | Brad Nicholson | 2007-10-12 16:08:40 | Re: Missing files under pg_data following power failure |
Previous Message | Joao Miguel Ferreira | 2007-10-12 15:54:48 | replicating to a stopped server |