Re: create index on a field of udt

Поиск
Список
Период
Сортировка
От John R Pierce
Тема Re: create index on a field of udt
Дата
Msg-id 5590D656.2070705@hogranch.com
обсуждение исходный текст
Ответ на create index on a field of udt  (Shujie Shang <sshang@pivotal.io>)
Ответы Re: create index on a field of udt  (Shujie Shang <sshang@pivotal.io>)
Список pgsql-general
On 6/28/2015 10:08 PM, Shujie Shang wrote:
create type info as (id int, name text);
I want to create index on info.id.


you can't create an index on a type, just on a table.

    create table info (id serial primary key, name text);

or

    create table info (id serial, name text);
    alter table info add primary key(id);

or more generically,

    create index on some_table ( some_field[,...] ) ;

(a primary key is a unique not null constraint, this implies an index in postgresql)


-- 
john r pierce, recycling bits in santa cruz

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

Предыдущее
От: Shujie Shang
Дата:
Сообщение: create index on a field of udt
Следующее
От: Shujie Shang
Дата:
Сообщение: Re: create index on a field of udt