| From: | Shujie Shang <sshang(at)pivotal(dot)io> |
|---|---|
| To: | John R Pierce <pierce(at)hogranch(dot)com> |
| Cc: | PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: create index on a field of udt |
| Date: | 2015-06-29 05:31:28 |
| Message-ID: | CAJrojKUK7uXoJ=fU86R3L+-KWS1=sPYJD==V2UaiaEOCLJCSAg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
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)
On Mon, Jun 29, 2015 at 1:23 PM, John R Pierce <pierce(at)hogranch(dot)com> wrote:
> 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
>
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andy Erskine | 2015-06-29 05:42:03 | Turn off streaming replication - leaving Master running |
| Previous Message | John R Pierce | 2015-06-29 05:23:34 | Re: create index on a field of udt |