| From: | John R Pierce <pierce(at)hogranch(dot)com> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: create index on a field of udt |
| Date: | 2015-06-29 05:51:02 |
| Message-ID: | 5590DCC6.1040100@hogranch.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On 6/28/2015 10:31 PM, Shujie Shang 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 <http://i.id>)
create table test of info primary key(id);
or, if you want to use your type plus other stuff in the table, I
believe its something like...
create table test (i info, stuff...) primary key (i.id)
or
create index test(i.id);
watch out for ambiguity if the type names match the table or field
name. see
http://www.postgresql.org/docs/current/static/rowtypes.html#AEN7836
--
john r pierce, recycling bits in santa cruz
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2015-06-29 05:52:49 | Re: Turn off streaming replication - leaving Master running |
| Previous Message | Andy Erskine | 2015-06-29 05:42:03 | Turn off streaming replication - leaving Master running |