The RLS patch added this to struct Query:

    List      *withCheckOptions;        /* a list of WithCheckOption's, which
                                         * are only added during rewrite and
                                         * therefore are not written out as
                                         * part of Query. */

As per the comment, this field is ignored by outfuncs.c and readfuncs.c.
That's pretty horrid, because:

1. Omitting the field from the output of pprint() seriously impedes
debugging.  I could probably have wasted significantly fewer hours
yesterday before figuring out fd195257 if pprint() hadn't been lying
to me about what was in the query data structures.

2. At some point, this will break parallel queries, or perhaps just
cause them to silently fail to enforce RLS, because we depend on
outfuncs/readfuncs to transfer node trees to parallel workers.
(I think there's no live bug today because we only transfer Plans
not Queries, but surely this is a loaded foot-gun.)

3. A node type as fundamental as Query ought not have weird gotchas
like this.

Furthermore, as far as I can see there's actually no point at all to the
special exception.  As the comment says, the list does not get populated
until rewrite time, which means that if outfuncs/readfuncs just process it
normally, it would always be NIL in stored views anyway.

It's too late to change this in 9.5, but I think we should do so
in HEAD.

                        regards, tom lane

Sent via pgsql-hackers mailing list (
To make changes to your subscription:

Reply via email to