[PATCH] Add some useful asserts into View Options macroses

Lists: pgsql-hackers
From: Nikolay Shaplov <dhyan(at)nataraj(dot)su>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Nikolay Shaplov <dhyan(at)nataraj(dot)su>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Dent John <denty(at)qqdd(dot)eu>, "Iwata, Aya" <iwata(dot)aya(at)jp(dot)fujitsu(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: [PATCH] Add some useful asserts into View Options macroses
Date: 2019-10-05 21:23:00
Message-ID: 3634983.eHpMQ1mJnI@x200m
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

This thread is a follow up to the thread https://www.postgresql.org/message-id/2620882.s52SJui4ql@x200m where I've been trying to remove StdRdOptions
structure and replace it with unique structure for each relation kind.

I've decided to split that patch into smaller parts.

This part adds some asserts to ViewOptions macroses.
Since an option pointer there is converted into (ViewOptions *) it would be
really good to make sure that this macros is called in proper context, and we
do the convertation properly. At least when running tests with asserts turned
on.

--
Software Developer: https://www.upwork.com/freelancers/~014a87e140ff02c0da
Body-oriented Therapist: https://vk.com/nataraj_rebalancing (Russian)

Attachment Content-Type Size
some-asserts-for-view-options-macroses_v1.diff text/x-patch 2.0 KB

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Nikolay Shaplov <dhyan(at)nataraj(dot)su>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Dent John <denty(at)qqdd(dot)eu>, "Iwata, Aya" <iwata(dot)aya(at)jp(dot)fujitsu(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: [PATCH] Add some useful asserts into View Options macroses
Date: 2019-10-07 16:59:27
Message-ID: CA+TgmobsfF_Rr89TS-2zDVTLjbp84WLJg4-reuqvN7yNHFMg6Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

On Sat, Oct 5, 2019 at 5:23 PM Nikolay Shaplov <dhyan(at)nataraj(dot)su> wrote:
> This thread is a follow up to the thread https://www.postgresql.org/message-id/2620882.s52SJui4ql@x200m where I've been trying to remove StdRdOptions
> structure and replace it with unique structure for each relation kind.
>
> I've decided to split that patch into smaller parts.
>
> This part adds some asserts to ViewOptions macroses.
> Since an option pointer there is converted into (ViewOptions *) it would be
> really good to make sure that this macros is called in proper context, and we
> do the convertation properly. At least when running tests with asserts turned
> on.

Seems like a good idea. Should we try to do something similar for the
macros in that header file that cast to StdRdOptions?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: Nikolay Shaplov <dhyan(at)nataraj(dot)su>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Dent John <denty(at)qqdd(dot)eu>, "Iwata, Aya" <iwata(dot)aya(at)jp(dot)fujitsu(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: [PATCH] Add some useful asserts into View Options macroses
Date: 2019-10-08 10:44:25
Message-ID: 4501528.Pae3bDk7cQ@x200m
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

В письме от понедельник, 7 октября 2019 г. 12:59:27 MSK пользователь Robert
Haas написал:

> > This thread is a follow up to the thread
> > https://www.postgresql.org/message-id/2620882.s52SJui4ql@x200m where I've
> > been trying to remove StdRdOptions structure and replace it with unique
> > structure for each relation kind.
> >
> > I've decided to split that patch into smaller parts.
> >
> > This part adds some asserts to ViewOptions macroses.
> > Since an option pointer there is converted into (ViewOptions *) it would
> > be
> > really good to make sure that this macros is called in proper context, and
> > we do the convertation properly. At least when running tests with asserts
> > turned on.
> Seems like a good idea. Should we try to do something similar for the
> macros in that header file that cast to StdRdOptions?

That would not be as easy as for ViewOptions. For example as for the current
master code, fillfactor from StdRdOptions is used in Toast, Heap, Hash index,
nbtree index, and spgist index. This will make RelationGetFillFactor macros a
bit complicated for example.

Now I have patches that limits usage of StdRdOptions to Heap and Toast.

When StdRdOptions is not that widely used, we whould be able to add asserts
for it, it will not make the code too complex.

So I would suggest to do ViewOptions asserts now, and keep dealing with
StdRdOptions for later. When we are finished with my current patches, I will
take care about it.

--
Software Developer: https://www.upwork.com/freelancers/~014a87e140ff02c0da
Body-oriented Therapist: https://vk.com/nataraj_rebalancing (Russian)


From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Nikolay Shaplov <dhyan(at)nataraj(dot)su>, Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Dent John <denty(at)qqdd(dot)eu>, "Iwata, Aya" <iwata(dot)aya(at)jp(dot)fujitsu(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: [PATCH] Add some useful asserts into View Options macroses
Date: 2019-11-01 12:29:58
Message-ID: bb465aed-06bf-5431-0f3c-f948e167ac80@2ndquadrant.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

On 2019-10-08 12:44, Nikolay Shaplov wrote:
> В письме от понедельник, 7 октября 2019 г. 12:59:27 MSK пользователь Robert
> Haas написал:
>
>>> This thread is a follow up to the thread
>>> https://www.postgresql.org/message-id/2620882.s52SJui4ql@x200m where I've
>>> been trying to remove StdRdOptions structure and replace it with unique
>>> structure for each relation kind.
>>>
>>> I've decided to split that patch into smaller parts.
>>>
>>> This part adds some asserts to ViewOptions macroses.
>>> Since an option pointer there is converted into (ViewOptions *) it would
>>> be
>>> really good to make sure that this macros is called in proper context, and
>>> we do the convertation properly. At least when running tests with asserts
>>> turned on.

Committed.

I simplified the parentheses by one level from your patch.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


From: Nikolay Shaplov <dhyan(at)nataraj(dot)su>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Dent John <denty(at)qqdd(dot)eu>, "Iwata, Aya" <iwata(dot)aya(at)jp(dot)fujitsu(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: [PATCH] Add some useful asserts into View Options macroses
Date: 2019-11-08 17:20:59
Message-ID: 1897489.GUaOmqQd2Z@x200m
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

В письме от пятница, 1 ноября 2019 г. 13:29:58 MSK пользователь Peter
Eisentraut написал:

> Committed.
>
> I simplified the parentheses by one level from your patch.
Thank you!

--
Software Developer: https://www.upwork.com/freelancers/~014a87e140ff02c0da
Body-oriented Therapist: https://vk.com/nataraj_rebalancing (Russian)