From: | Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp> |
---|---|
To: | Andrey Borodin <x4mmm(at)yandex-team(dot)ru> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Aditya Toshniwal <aditya(dot)toshniwal(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [PG-11] Potential bug related to INCLUDE clause of CREATE INDEX |
Date: | 2018-07-12 06:58:08 |
Message-ID: | 20180712155808.49e712d8.nagata@sraoss.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, 10 Jul 2018 20:37:49 +0400
Andrey Borodin <x4mmm(at)yandex-team(dot)ru> wrote:
> Hi!
>
> > 10 июля 2018 г., в 17:54, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> написал(а):
> >
> > Aditya Toshniwal <aditya(dot)toshniwal(at)enterprisedb(dot)com> writes:
> >> 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.
> >
> > I wonder why there is any such restriction at all. We have never
> > attempted to prevent the creation of "silly" indexes [...] So my inclination is to rip out the "must not intersect" test altogether,
> > not try to make it a bit smarter
>
> It seems to me valid way of reaching the completely consistent validation behavior. But there are some other validation steps that seem useful: e.g. "ERROR: including column does not support ASC/DESC options" and "ERROR: including column does not support NULLS FIRST/LAST options".
>
> IMHO it is not a bug. CREATE INDEX ON some_table(id+0) INCLUDE (id); or some similar tricks will work anyway.
Yes, more simplly, the following query also works;
CREATE INDEX ON test((i)) INCLUDE (i);
However, a problem is that when we use pg_dump for the database, this generate the following query
CREATE INDEX test_i_i1_idx ON public.test USING btree (i) INCLUDE (i);
Of cause, this causes the "must not intersect" error, and we cannot restore this dump.
To fix this, we agree with Tom about getting rid of "must not intersect" restriction.
A patch is attached for this
Regards,
--
Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
Attachment | Content-Type | Size |
---|---|---|
get_rid_must_not_intersect.patch | text/x-diff | 539 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Yugo Nagata | 2018-07-12 07:20:13 | Re: [PG-11] Potential bug related to INCLUDE clause of CREATE INDEX |
Previous Message | Yugo Nagata | 2018-07-12 06:35:53 | Re: Temporary WAL segments files not cleaned up after an instance crash |