public inbox for [email protected]
help / color / mirror / Atom feedFrom: aditya desai <[email protected]>
To: Christophe Pettus <[email protected]>
Cc: pgsql-sql <[email protected]>
Subject: Re: Create index on user defined type
Date: Tue, 19 Apr 2022 22:33:17 +0530
Message-ID: <CAN0SRDHH=10fPDh2tTY0cjLdTzESeaoV1YRPgk=mvxhcNqM_=w@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CAN0SRDHgW+5-yGdLE-y6eCpWdffV7iexabGL1PmZOb7BU=QeWg@mail.gmail.com>
<[email protected]>
Thanks! Apologies! Looks like I was having issues with NULL values and
UNIQUE index on user defined column.
On Tue, Apr 19, 2022 at 10:00 PM Christophe Pettus <[email protected]> wrote:
>
> > On Apr 19, 2022, at 09:27, aditya desai <[email protected]> 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=#
>
>
view thread (5+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Create index on user defined type
In-Reply-To: <CAN0SRDHH=10fPDh2tTY0cjLdTzESeaoV1YRPgk=mvxhcNqM_=w@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox