Thread: SPI_fnumber can't see oid
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
admin <admin@wtbwts.com> writes: > 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? I think the SPI code is deliberately set up to prevent access to the system attributes. Jan Wieck is probably the only one who knows exactly why, but I'll bet that something will break if you bypass that restriction :-( regards, tom lane