From: | Jeff Janes <jeff(dot)janes(at)gmail(dot)com> |
---|---|
To: | Shujie Shang <sshang(at)pivotal(dot)io> |
Cc: | John R Pierce <pierce(at)hogranch(dot)com>, PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: create index on a field of udt |
Date: | 2015-06-29 06:41:51 |
Message-ID: | CAMkU=1x8AQpW+YWumk7cQETp1Am7USvdG5qxXmkHyyRrJCFzsg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Sun, Jun 28, 2015 at 10:31 PM, Shujie Shang <sshang(at)pivotal(dot)io> wrote:
> Oh, I didn't explain my question well, actually I want to create an index
> on an udt in a table.
>
> e.g.
> create type info as (id int, name text);
> creat table test (i info);
> I want to run:
> create index myindex on test (i.id)
>
>
>
It is a matter of finding the correct level of magic parentheses.
create index on test (((i).id));
The outer layer are always needed for creating indexes. The middle layer
are needed because you are indexing an expression, not a column. And the
inner layer is needed because, well, that is just how udt works.
Cheers,
Jeff
From | Date | Subject | |
---|---|---|---|
Next Message | John R Pierce | 2015-06-29 06:45:06 | Re: create index on a field of udt |
Previous Message | Andy Erskine | 2015-06-29 06:34:53 | Re: Turn off streaming replication - leaving Master running |