Is this transformation correct? If I read this correctly, you're
missing the rangeTableEntry_used() condition, no?
> *** a/src/backend/rewrite/rewriteHandler.c
> --- b/src/backend/rewrite/rewriteHandler.c
> ***************
> *** 1273,1287 **** matchLocks(CmdType event,
> }
> }
>
> ! if (oneLock->event == event)
> ! {
> ! if (parsetree->commandType != CMD_SELECT ||
> ! (oneLock->attrno == -1 ?
> ! rangeTableEntry_used((Node *) parsetree, varno, 0) :
> ! attribute_used((Node *) parsetree,
> ! varno, oneLock->attrno, 0)))
> ! matching_locks = lappend(matching_locks, oneLock);
> ! }
> }
>
> return matching_locks;
> --- 1273,1280 ----
> }
> }
>
> ! if (oneLock->event == event && parsetree->commandType != CMD_SELECT)
> ! matching_locks = lappend(matching_locks, oneLock);
> }
>
> return matching_locks;
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services