Jens Glaser <jens@helena.jens.de> writes:
> select * from pg_attribute where (case when 1=1 then
> (attname='testname') else (0=1) end);
This is fixed in current sources, but for some reason it didn't get
back-patched into REL6_5. Done now. Here's the patch if you're in a
hurry.
*** backend/optimizer/path/indxpath.c.orig Sat Jun 19 00:54:14 1999
--- backend/optimizer/path/indxpath.c Tue Sep 14 16:26:02 1999
***************
*** 585,596 **** Oid restrict_op = InvalidOid; bool isIndexable = false;
! if (or_clause((Node *) clause) ||
! not_clause((Node *) clause) || single_node((Node *) clause))
! return (RestrictInfo *) NULL;
! leftop = get_leftop(clause); rightop = get_rightop(clause); /* * If this is not a join clause,
checkfor clauses of the form:
--- 585,597 ---- Oid restrict_op = InvalidOid; bool isIndexable = false;
! /* Clause must be a binary opclause. */
! if (! is_opclause((Node *) clause))
! return NULL; leftop = get_leftop(clause); rightop = get_rightop(clause);
+ if (! leftop || ! rightop)
+ return NULL; /* * If this is not a join clause, check for clauses of the form:
regards, tom lane