Unsupported versions: 7.3 / 7.2 / 7.1
This documentation is for an unsupported version of PostgreSQL.
You may want to view the same page for the current version, or one of the other supported versions listed above instead.

fieldnum

Name

fieldnum -- field name-number conversion

Synopsis

fieldnum(name)

Parameters

name

field name (string).

Return Type

integer

field number (integer).

Exceptions

TypeError

Bad parameter type, or too many arguments.

ValueError

Unknown field name.

pg.error

Invalid query result, or invalid connection.

Description

fieldnum() method returns a field number from its name. It can be used to build a function that converts result list strings to their correct type, using a hardcoded table definition. The number returned is the field rank in the result values list.