It seems SPI_fnumber can't recognize oid as an attribute for a tuple
description. I performed my tests using contrib/spi/refint.c which uses
function to test the validity of the trigger for check_foreign_key() and
for check_primary_key(). I changed refint.c slightly to verify that
SPI_fnumber was really returning SPI_ERROR_NOATTRIBUTE and indeed it was.
Here's the exact line I got from the check_foreign_key trigger:
ERROR: check_foreign_key: there is no attribute oid in relation product
Looking at src/backend/executor/spi.c, I noticed SPI_fnumber started
counting at 0. Is this normal or should it be -1, assuming oid might be
just before 0?
Let me know what you think,
Marc