INDEX with optional storage parameter value

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

INDEX with optional storage parameter value

PG Doc comments form
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/12/sql-createindex.html
Description:

Hello!
I noticed an slight inaccuracy in the documentation for CREATE INDEX and
ALTER INDEX:

CREATE INDEX ... [ WITH ( storage_parameter = value [, ... ] ) ]
ALTER INDEX [ IF EXISTS ] name SET ( storage_parameter = value [, ... ] )

In indices, as in tables, you can omit the вoolean value for a parameter.
For example:

CREATE INDEX ON public.testtable USING GIN (c1) WITH (fastupdate);
ALTER INDEX testtable_c1_idx SET (fastupdate);

It might be more correct to use the construct from CREATE TABLE:

storage_parameter [= value] [, ... ]
Reply | Threaded
Open this post in threaded view
|

Re: INDEX with optional storage parameter value

Bruce Momjian
On Mon, Jun 22, 2020 at 01:13:52PM +0000, PG Doc comments form wrote:

> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/12/sql-createindex.html
> Description:
>
> Hello!
> I noticed an slight inaccuracy in the documentation for CREATE INDEX and
> ALTER INDEX:
>
> CREATE INDEX ... [ WITH ( storage_parameter = value [, ... ] ) ]
> ALTER INDEX [ IF EXISTS ] name SET ( storage_parameter = value [, ... ] )
>
> In indices, as in tables, you can omit the вoolean value for a parameter.
> For example:
>
> CREATE INDEX ON public.testtable USING GIN (c1) WITH (fastupdate);
> ALTER INDEX testtable_c1_idx SET (fastupdate);
>
> It might be more correct to use the construct from CREATE TABLE:
>
> storage_parameter [= value] [, ... ]
Yes, I see that:

        CREATE TABLE testtable (c1 JSONB);
        CREATE INDEX ON public.testtable USING GIN (c1) WITH (fastupdate = true);
        CREATE INDEX ON public.testtable USING GIN (c1) WITH (fastupdate = false);
        CREATE INDEX ON public.testtable USING GIN (c1) WITH (fastupdate);
        \d testtable
                    Table "public.testtable"
         Column | Type  | Collation | Nullable | Default
        --------+-------+-----------+----------+---------
         c1     | jsonb |           |          |
        Indexes:
            "testtable_c1_idx" gin (c1) WITH (fastupdate='true')
            "testtable_c1_idx1" gin (c1) WITH (fastupdate='false')
            "testtable_c1_idx2" gin (c1) WITH (fastupdate='true')

I found a few more places that also didn't properly document this;
patch attached.

--
  Bruce Momjian  <[hidden email]>        https://momjian.us
  EnterpriseDB                             https://enterprisedb.com

  The usefulness of a cup is in its emptiness, Bruce Lee


storage.diff (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: INDEX with optional storage parameter value

Michael Paquier-2
On Sat, Jun 27, 2020 at 05:14:23PM -0400, Bruce Momjian wrote:
> I found a few more places that also didn't properly document this;
> patch attached.

Good catch!  I am not seeing any missing spots, so this looks good to
me.  You are planning a backpatch, right?
--
Michael

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: INDEX with optional storage parameter value

Laurenz Albe
In reply to this post by Bruce Momjian
On Sat, 2020-06-27 at 17:14 -0400, Bruce Momjian wrote:

> > I noticed an slight inaccuracy in the documentation for CREATE INDEX and
> > ALTER INDEX:
> >
> > CREATE INDEX ... [ WITH ( storage_parameter = value [, ... ] ) ]
> > ALTER INDEX [ IF EXISTS ] name SET ( storage_parameter = value [, ... ] )
> >
> > In indices, as in tables, you can omit the вoolean value for a parameter.
> > For example:
> >
> > CREATE INDEX ON public.testtable USING GIN (c1) WITH (fastupdate);
> > ALTER INDEX testtable_c1_idx SET (fastupdate);
> >
> > It might be more correct to use the construct from CREATE TABLE:
> >
> > storage_parameter [= value] [, ... ]
>
> I found a few more places that also didn't properly document this;
> patch attached.
Looks good.
Perhaps it is worth explaining this explicitly, as in the attached.

Yours,
Laurenz Albe

0001-Document-that-values-can-be-omitted-for-boolean-stor.patch (10K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: INDEX with optional storage parameter value

Bruce Momjian
In reply to this post by Michael Paquier-2
On Mon, Jun 29, 2020 at 04:18:58PM +0900, Michael Paquier wrote:
> On Sat, Jun 27, 2020 at 05:14:23PM -0400, Bruce Momjian wrote:
> > I found a few more places that also didn't properly document this;
> > patch attached.
>
> Good catch!  I am not seeing any missing spots, so this looks good to
> me.  You are planning a backpatch, right?

Yes, backpatch.  I found the pattern of areas needing fixes to be quite
odd.  ;-)

--
  Bruce Momjian  <[hidden email]>        https://momjian.us
  EnterpriseDB                             https://enterprisedb.com

  The usefulness of a cup is in its emptiness, Bruce Lee



Reply | Threaded
Open this post in threaded view
|

Re: INDEX with optional storage parameter value

Bruce Momjian
In reply to this post by Laurenz Albe
On Mon, Jun 29, 2020 at 09:26:57AM +0200, Laurenz Albe wrote:

> On Sat, 2020-06-27 at 17:14 -0400, Bruce Momjian wrote:
> > > I noticed an slight inaccuracy in the documentation for CREATE INDEX and
> > > ALTER INDEX:
> > >
> > > CREATE INDEX ... [ WITH ( storage_parameter = value [, ... ] ) ]
> > > ALTER INDEX [ IF EXISTS ] name SET ( storage_parameter = value [, ... ] )
> > >
> > > In indices, as in tables, you can omit the вoolean value for a parameter.
> > > For example:
> > >
> > > CREATE INDEX ON public.testtable USING GIN (c1) WITH (fastupdate);
> > > ALTER INDEX testtable_c1_idx SET (fastupdate);
> > >
> > > It might be more correct to use the construct from CREATE TABLE:
> > >
> > > storage_parameter [= value] [, ... ]
> >
> > I found a few more places that also didn't properly document this;
> > patch attached.
>
> Looks good.
> Perhaps it is worth explaining this explicitly, as in the attached.

Uh, I considered this, but it seems unnecessary at this time.

--
  Bruce Momjian  <[hidden email]>        https://momjian.us
  EnterpriseDB                             https://enterprisedb.com

  The usefulness of a cup is in its emptiness, Bruce Lee



Reply | Threaded
Open this post in threaded view
|

Re: INDEX with optional storage parameter value

Bruce Momjian
In reply to this post by Bruce Momjian
On Mon, Jun 29, 2020 at 09:53:17AM -0400, Bruce Momjian wrote:

> On Mon, Jun 29, 2020 at 04:18:58PM +0900, Michael Paquier wrote:
> > On Sat, Jun 27, 2020 at 05:14:23PM -0400, Bruce Momjian wrote:
> > > I found a few more places that also didn't properly document this;
> > > patch attached.
> >
> > Good catch!  I am not seeing any missing spots, so this looks good to
> > me.  You are planning a backpatch, right?
>
> Yes, backpatch.  I found the pattern of areas needing fixes to be quite
> odd.  ;-)

Patch applied through 9.5.

--
  Bruce Momjian  <[hidden email]>        https://momjian.us
  EnterpriseDB                             https://enterprisedb.com

  The usefulness of a cup is in its emptiness, Bruce Lee