Re: [PG-11] Potential bug related to INCLUDE clause of CREATE INDEX

From: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: Aditya Toshniwal <aditya(dot)toshniwal(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PG-11] Potential bug related to INCLUDE clause of CREATE INDEX
Date: 2018-07-10 15:44:06
Message-ID: CAFiTN-sou6OTmQewWLxXu4EgMq1Yf3-O-xZHBfC8X30PYWNr+A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jul 10, 2018 at 6:37 PM, Aditya Toshniwal
<aditya(dot)toshniwal(at)enterprisedb(dot)com> wrote:
> 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 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.
>

Seems like a bug to me. I think the problem is while checking whether
the INCLUDE column intersects with the index key or not it will
compare the "IndexElem" of INCLUDE with the "IndexElem" of the index
key. So if any field of the "IndexElem" is not same then it will be
considered as non-intersecting and in this example, the ORDER is not
matching.

--
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Kuzmenkov 2018-07-10 16:36:56 Re: [HACKERS] PoC: full merge join on comparison clause
Previous Message Heikki Linnakangas 2018-07-10 14:35:58 Re: [HACKERS] WAL logging problem in 9.4.3?