pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Beautify initialization of JsonValueList and JsonLikeRegexContex
5+ messages / 4 participants
[nested] [flat]

Commits from this thread:
  2019-03-18 a0478b6998  Revert 4178d8b91c
* pgsql: Beautify initialization of JsonValueList and JsonLikeRegexContex
@ 2019-03-17 09:59  Alexander Korotkov <akorotkov@postgresql.org>
  0 siblings, 1 reply; 5+ messages in thread

From: Alexander Korotkov @ 2019-03-17 09:59 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Beautify initialization of JsonValueList and JsonLikeRegexContext

Instead of tricky assignment to {0} introduce special macros, which
explicitly initialize every field.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4178d8b91cb943b422d1837b4b7798576d88995a

Modified Files
--------------
src/backend/utils/adt/jsonpath_exec.c | 32 ++++++++++++++++++--------------
1 file changed, 18 insertions(+), 14 deletions(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: Beautify initialization of JsonValueList and JsonLikeRegexContex
@ 2019-03-17 11:59  Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  parent: Alexander Korotkov <akorotkov@postgresql.org>
  0 siblings, 1 reply; 5+ messages in thread

From: Peter Eisentraut @ 2019-03-17 11:59 UTC (permalink / raw)
  To: Alexander Korotkov <akorotkov@postgresql.org>; pgsql-committers@lists.postgresql.org

On 2019-03-17 10:59, Alexander Korotkov wrote:
> Beautify initialization of JsonValueList and JsonLikeRegexContext
> 
> Instead of tricky assignment to {0} introduce special macros, which
> explicitly initialize every field.

To me, this patch is exactly the opposite of what I'd do to "beautify
initialization".  It doesn't seem sustainable to me to create a special
macro for every structure in the code, not does it improve readability.
It is much clearer that {0} is uniformly the starting state.

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




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: Beautify initialization of JsonValueList and JsonLikeRegexContex
@ 2019-03-17 12:09  Alexander Korotkov <a.korotkov@postgrespro.ru>
  parent: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Alexander Korotkov @ 2019-03-17 12:09 UTC (permalink / raw)
  To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; +Cc: Alexander Korotkov <akorotkov@postgresql.org>; pgsql-committers <pgsql-committers@lists.postgresql.org>

On Sun, Mar 17, 2019 at 3:00 PM Peter Eisentraut
<peter.eisentraut@2ndquadrant.com> wrote:
> On 2019-03-17 10:59, Alexander Korotkov wrote:
> > Beautify initialization of JsonValueList and JsonLikeRegexContext
> >
> > Instead of tricky assignment to {0} introduce special macros, which
> > explicitly initialize every field.
>
> To me, this patch is exactly the opposite of what I'd do to "beautify
> initialization".  It doesn't seem sustainable to me to create a special
> macro for every structure in the code, not does it improve readability.
> It is much clearer that {0} is uniformly the starting state.

I got two reasons in the mind while committing that:
1) We would probably like to make some values of empty state non-zero in future.
2) In general, it's better to not assume that NULL is binary zero.
However, we assume that a lot in other places.  So, it probably
doesn't matter.

Anyway, I thought about this as about just beautification.  If it's
bad idea, let's revert this.

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: Beautify initialization of JsonValueList and JsonLikeRegexContex
@ 2019-03-18 04:12  Michael Paquier <michael@paquier.xyz>
  parent: Alexander Korotkov <a.korotkov@postgrespro.ru>
  0 siblings, 1 reply; 5+ messages in thread

From: Michael Paquier @ 2019-03-18 04:12 UTC (permalink / raw)
  To: Alexander Korotkov <a.korotkov@postgrespro.ru>; +Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; Alexander Korotkov <akorotkov@postgresql.org>; pgsql-committers <pgsql-committers@lists.postgresql.org>

On Sun, Mar 17, 2019 at 03:09:07PM +0300, Alexander Korotkov wrote:
> Anyway, I thought about this as about just beautification.  If it's
> bad idea, let's revert this.

I agree with Peter's point here that having {0} as initial state is
cleaner instead of adding an extra level of abstraction.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: Beautify initialization of JsonValueList and JsonLikeRegexContex
@ 2019-03-18 06:56  Alexander Korotkov <a.korotkov@postgrespro.ru>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 5+ messages in thread

From: Alexander Korotkov @ 2019-03-18 06:56 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; Alexander Korotkov <akorotkov@postgresql.org>; pgsql-committers <pgsql-committers@lists.postgresql.org>

On Mon, Mar 18, 2019 at 7:12 AM Michael Paquier <michael@paquier.xyz> wrote:
>
> On Sun, Mar 17, 2019 at 03:09:07PM +0300, Alexander Korotkov wrote:
> > Anyway, I thought about this as about just beautification.  If it's
> > bad idea, let's revert this.
>
> I agree with Peter's point here that having {0} as initial state is
> cleaner instead of adding an extra level of abstraction.

OK!  So, reverted.

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company




^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2019-03-18 06:56 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-03-17 09:59 pgsql: Beautify initialization of JsonValueList and JsonLikeRegexContex Alexander Korotkov <akorotkov@postgresql.org>
2019-03-17 11:59 ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2019-03-17 12:09   ` Alexander Korotkov <a.korotkov@postgrespro.ru>
2019-03-18 04:12     ` Michael Paquier <michael@paquier.xyz>
2019-03-18 06:56       ` Alexander Korotkov <a.korotkov@postgrespro.ru>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox