Re: [HACKERS] safer node casting - Mailing list pgsql-hackers

From Jeff Janes
Subject Re: [HACKERS] safer node casting
Date
Msg-id CAMkU=1x63f2QyFTeas83xJqD+Hm1PBuok1LrzYzS-OngDzYOVA@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] safer node casting  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Responses Re: [HACKERS] safer node casting
List pgsql-hackers
On Tue, Feb 21, 2017 at 9:00 AM, Peter Eisentraut <peter.eisentraut@2ndquadrant.com> wrote:
On 1/26/17 16:15, Andres Freund wrote:
> On 2017-01-25 19:21:40 -0500, Tom Lane wrote:
>> Andres Freund <andres@anarazel.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).

Thanks for finishing that up.  I have committed more uses that I had
lying around partially done.  Looks nice now.


With commit 38d103763d14baddf3cbfe4b00b501059fc9447f, I'm now getting a compiler warning:

indxpath.c: In function 'generate_bitmap_or_paths':
indxpath.c:1312: warning: unused variable 'rinfo'


I have: gcc version 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC)

No arguments to ./configure are needed.

Cheers,

Jeff

pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: [HACKERS] Json support for array pseudotypes
Next
From: James Cloos
Date:
Subject: Re: [HACKERS] Replication vs. float timestamps is a disaster