Checking assumptions

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Checking assumptions
Date: 2006-04-20 11:05:47
Message-ID: 20060420110547.GA1984@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I havn't been able to find any more serious issues in the Coverity
report, now that they've fixed the ereport() issue. A number of the
issues it complains about are things we already Assert() for. For the
rest, as long as the following assumptions are true we're done (well,
except for ECPG). I think they are true but it's always good to check:

src/backend/executor/nodeMaterial.c function ExecMaterial
if( !node->randomAccess && !ScanDirectionIsForward && !node->eof_underlying )
dies line 87

randomAccess is set if EXEC_FLAG_BACKWARD is set, but does that
guarentee it will never be tried?

src/backend/optimizer/plan/planner.c function inheritance_planner

If the bulk of the loop is skipped for any reason, we segfault right
after. This can only happen if ((PlannerInfo *)root)->append_rel_list
is empty or only contains the resultRelation. I can't convince myself
this is always ok. The condition that invokes this function in
subquery_planner is obtuse enough that I can't trigger it.

src/backend/utils/adt/selfuncs.c function like_selectivity

Assume this function is never called with a zero length bytea
constant. It just looks wierd to set patt to NULL only to Assert() it
three lines down.

src/backend/utils/adt/ruleutils.c function get_sublink_expr

We assume sublink->subLinkType == ANY_SUBLINK implies
sublink->testexpr != NULL. Otherwise we die at line 4114.

src/backend/rewrite/rewriteHandler.c function AcquireRewriteLocks

Assume ((Var*)var)->varno > 0

src/backend/executor/execMain.c function ExecutePlan

We assume an UPDATE statement always has a junkfilter.

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2006-04-20 11:19:16 Re: pg_dump -Ft failed on Windows XP
Previous Message Magnus Hagander 2006-04-20 11:03:40 Re: pg_dump -Ft failed on Windows XP