Search Postgresql Archives

Re: create index on a field of udt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jun 28, 2015 at 10:31 PM, Shujie Shang <sshang@xxxxxxxxxx> 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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux