Re: [sqlsmith] Planner crash on foreign table join

Andrew Gierth <andrew@tao11.riddles.org.uk>

From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Andreas Seltenreich <seltenreich@gmx.de>, pgsql-hackers@postgresql.org, Simon Riggs <simon@2ndquadrant.com>
Date: 2017-04-08T20:27:28Z
Lists: pgsql-hackers
>>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:

 Tom> Experimentation shows that actually, the standard regression tests
 Tom> provide dozens of opportunities for find_relation_from_clauses to
 Tom> fail on non-RestrictInfo input.  However, it lacks any IsA check,

In a discussion with Andres on the hash grouping sets review thread, I
proposed that we should have something of the form

#define lfirst_node(_type_, l) (castNode(_type_,lfirst(l)))

to replace the current idiom of

    foreach(l, blah)
    {
        SomeType *x = (SomeType *) lfirst(l);

(in my code I tend to omit the (SomeType *), which I dislike because it
adds no real protection)

by

    foreach(l, blah)
    {
        SomeType *x = lfirst_node(SomeType, l);

in order to get that IsA check in there in a convenient way.

-- 
Andrew (irc:RhodiumToad)


Commits

  1. Improve castNode notation by introducing list-extraction-specific variants.

  2. Clean up bugs in clause_selectivity() cleanup.

  3. Add newly-symlinked files to "make clean" target.

  4. Reset API of clause_selectivity()