Index: pl_exec.c =================================================================== RCS file: /projects/cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v retrieving revision 1.160 diff -c -r1.160 pl_exec.c *** pl_exec.c 10 Jan 2006 18:50:43 -0000 1.160 --- pl_exec.c 12 Feb 2006 17:13:39 -0000 *************** *** 4469,4483 **** static bool compatible_tupdesc(TupleDesc td1, TupleDesc td2) { ! int i; ! if (td1->natts != td2->natts) ! return false; ! ! for (i = 0; i < td1->natts; i++) { ! if (td1->attrs[i]->atttypid != td2->attrs[i]->atttypid) return false; } return true; --- 4469,4507 ---- static bool compatible_tupdesc(TupleDesc td1, TupleDesc td2) { ! int i = 0, j = 0, natts1 = td1->natts, natts2 = td2->natts; ! while ((i < natts1) && (j < natts2)) { ! /* We should skip the dropped columns */ ! if (td1->attrs[i]->attisdropped) ! { ! i++; ! continue; ! } ! if (td2->attrs[j]->attisdropped) ! { ! j++; ! continue; ! } ! ! if (td1->attrs[i]->atttypid != td2->attrs[j]->atttypid) ! { return false; + } + else + { + i++; + j++; + } + } + + while ((i < natts1) && (td1->attrs[i]->attisdropped)) i++; + while ((j < natts2) && (td2->attrs[j]->attisdropped)) j++; + + if ((i != natts1) || (j != natts2)) + { + return false; } return true;