select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Unsupported versions: 7.3 / 7.2 / 7.1
Historical version. PostgreSQL 7.3 reached end of support in November 2007. See the current manual for supported releases.

fieldnum

Name

fieldnum -- get field number by name

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.

Report a documentation issue

Read the upstream documentation. For corrections, first check the current manual.