This page in other versions: Unsupported versions: 7.1 / 7.2 / 7.3



SPI_fnumber -- Finds the attribute number for specified attribute name


SPI_fnumber(tupdesc, fname)


TupleDesc tupdesc

Input tuple description

char * fname

Field name



Attribute number

Valid one-based index number of attribute
SPI_ERROR_NOATTRIBUTE if the named attribute is not found


SPI_fnumber returns the attribute number for the attribute with name in fname.


Attribute numbers are 1 based.

If the given fname refers to a system attribute (eg, oid) then the appropriate negative attribute number will be returned. The caller should be careful to test for exact equality to SPI_ERROR_NOATTRIBUTE to detect error; testing for result <= 0 is not correct unless system attributes should be rejected.

Submit correction

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.

Privacy Policy | About PostgreSQL
Copyright © 1996-2016 The PostgreSQL Global Development Group