Re: Create index on user defined type

From: Christophe Pettus <xof(at)thebuild(dot)com>
To: aditya desai <admad123(at)gmail(dot)com>
Cc: pgsql-sql <pgsql-sql(at)lists(dot)postgresql(dot)org>
Subject: Re: Create index on user defined type
Date: 2022-04-19 16:29:37
Message-ID: 4D6ADD6D-0E11-4E6C-BF6D-AFB57FFF1B67@thebuild.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


> On Apr 19, 2022, at 09:27, aditya desai <admad123(at)gmail(dot)com> wrote:
>
> Hi,
> Is there any way to create index on user defined type in Postgresql? Need to create index on bug_status in bug table.
>
> CREATE TYPE bug_status AS ENUM ('new', 'open', 'closed');
>
> CREATE TABLE bug (
> id serial,
> description text,
> status bug_status
> );

It works right out of the box:

xof=# CREATE TYPE bug_status AS ENUM ('new', 'open', 'closed');
CREATE TYPE
xof=# CREATE TABLE bug (
id serial,
description text,
status bug_status
);
CREATE TABLE
xof=# create index on bug(status);
CREATE INDEX
xof=#

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message aditya desai 2022-04-19 17:03:17 Re: Create index on user defined type
Previous Message aditya desai 2022-04-19 16:27:18 Create index on user defined type