Marti Raudsepp <ma...@juffo.org> writes: > On Sun, Jun 8, 2014 at 3:36 PM, David Rowley <dgrowle...@gmail.com> wrote: >> Currently pull_up_sublinks_qual_recurse only changes the plan for NOT EXISTS >> queries and leaves NOT IN alone. The reason for this is because the values >> returned by a subquery in the IN clause could have NULLs.
> I believe the reason why this hasn't been done yet, is that the plan > becomes invalid when another backend modifies the nullability of the > column. To get it to replan, you'd have to introduce a dependency on > the "NOT NULL" constraint, but it's impossible for now because there's > no pg_constraint entry for NOT NULLs. I don't believe this is an issue, because we are only talking about a *plan* depending on the NOT NULL condition. ALTER TABLE DROP NOT NULL would result in a relcache inval event against the table, which would result in invalidating all cached plans mentioning the table. I forget exactly what context we were discussing needing a NOT NULL constraint's OID for, but it would have to be something where the dependency was longer-lived than a plan; perhaps semantics of a view? The existing comparable case is that a view containing ungrouped variable references is allowed if the GROUP BY includes a primary key, which means the semantic validity of the view depends on the pkey. regards, tom lane -- Sent via pgsql-hackers mailing list (email@example.com) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers