[PG-11] Potential bug related to INCLUDE clause of CREATE INDEX - Mailing list pgsql-hackers

From Aditya Toshniwal
Subject [PG-11] Potential bug related to INCLUDE clause of CREATE INDEX
Date
Msg-id CAM9w-_mhBCys4fQNfaiQKTRrVWtoFrZ-wXmDuE9Nj5y-Y7aDKQ@mail.gmail.com
Whole thread Raw
Responses Re: [PG-11] Potential bug related to INCLUDE clause of CREATE INDEX  (Aditya Toshniwal <aditya.toshniwal@enterprisedb.com>)
Re: [PG-11] Potential bug related to INCLUDE clause of CREATE INDEX  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: [PG-11] Potential bug related to INCLUDE clause of CREATE INDEX  (Dilip Kumar <dilipbalaut@gmail.com>)
List pgsql-hackers
Hi Dave, 

I am working on a feature to support INCLUDE clause of index in PG-11. As per the documentation https://www.postgresql.org/docs/11/static/sql-createindex.html, columns listed in INCLUDE clause cannot also be present as index key columns. But I find different behaviour for below queries which are logically identical.

CREATE TABLE some_table
(
    id serial primary key,
    first_name character varying(45),
    last_name character varying
)

CREATE INDEX ind1
    ON public.some_table USING btree
    (id)
    INCLUDE(id)
    TABLESPACE pg_default;

This query fails with error
ERROR: included columns must not intersect with key columns

CREATE INDEX ind1
    ON public.some_table USING btree
    (id asc nulls last)
    INCLUDE(id)
    TABLESPACE pg_default;

This query passes and index is created.

Kindly let me know if I am missing anything.

--
Thanks and Regards,
Aditya Toshniwal
Software Engineer | EnterpriseDB Software Solutions | Pune
"Don't Complain about Heat, Plant a tree"

pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: shared-memory based stats collector
Next
From: Aditya Toshniwal
Date:
Subject: Re: [PG-11] Potential bug related to INCLUDE clause of CREATE INDEX