Re: safer node casting

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: safer node casting
Date: 2017-01-26 21:15:41
Message-ID: 20170126211541.auhepsrwhapvbgig@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2017-01-25 19:21:40 -0500, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > On 2016-12-31 12:08:22 -0500, Peter Eisentraut wrote:
> >> RestrictInfo *rinfo = castNode(RestrictInfo, lfirst(lc));
>
> > Are you planning to add this / update this patch? Because I really would
> > have liked this a number of times already... I can update it according
> > to my suggestions (to avoid multiple eval scenarios) if helpful
>
> Yeah, I'd like that in sooner rather than later, too. But we do need
> it to be foolproof - no multiple evals. The first draft had
> inadequate-parenthesization hazards,

How about something like the attached? The first patch just contains
castNode(), the second one a rebased version of Peter's changes (with
some long lines broken up).

Andres

Attachment Content-Type Size
0001-Add-castNode-type-ptr-for-safe-casting-between-NodeT.patch text/x-patch 1.6 KB
0002-Use-the-new-castNode-macro-in-a-subset-of-places.patch text/x-patch 32.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-01-26 21:16:50 Re: Failure in commit_ts tap tests
Previous Message David Rowley 2017-01-26 21:15:35 Re: Performance improvement for joins where outer side is unique