PostgreSQL 7.2 Documentation
Prev |  | Next

# 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.

Prev | Home | Next
fieldname | Up | ntuples