Re: create index on a field of udt

Поиск
Список
Период
Сортировка
От Jeff Janes
Тема Re: create index on a field of udt
Дата
Msg-id CAMkU=1x8AQpW+YWumk7cQETp1Am7USvdG5qxXmkHyyRrJCFzsg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: create index on a field of udt  (Shujie Shang <sshang@pivotal.io>)
Ответы Re: create index on a field of udt  ("Charles Clavadetscher" <clavadetscher@swisspug.org>)
Список pgsql-general
On Sun, Jun 28, 2015 at 10:31 PM, Shujie Shang <sshang@pivotal.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

В списке pgsql-general по дате отправления:

Предыдущее
От: John R Pierce
Дата:
Сообщение: Re: create index on a field of udt
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: Turn off streaming replication - leaving Master running