public inbox for [email protected]  
help / color / mirror / Atom feed
From: Rob Sargent <[email protected]>
To: [email protected]
Subject: Re: Create index on user defined type
Date: Tue, 19 Apr 2022 12:18:32 -0600
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAN0SRDHH=10fPDh2tTY0cjLdTzESeaoV1YRPgk=mvxhcNqM_=w@mail.gmail.com>
References: <CAN0SRDHgW+5-yGdLE-y6eCpWdffV7iexabGL1PmZOb7BU=QeWg@mail.gmail.com>
	<[email protected]>
	<CAN0SRDHH=10fPDh2tTY0cjLdTzESeaoV1YRPgk=mvxhcNqM_=w@mail.gmail.com>

On 4/19/22 11:03, aditya desai wrote:
> 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=#
>
I would have to wonder at the effectiveness an index on such a small 
number of possible values.

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]
  Subject: Re: Create index on user defined type
  In-Reply-To: <[email protected]>

* 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