Because complete documentation is always helpful, here are all the PostgreSQL general purpose types as they are listed in the 8.1 documentation, and each corresponding string returned by pg_field_type().
bigint => int8
bigserial => int8
bit => bit
bit varying => varbit
boolean => bool
box => box
bytea => bytea
character varying => varchar
character => bpchar
cidr => cidr
circle => circle
date => date
double precision => float8
inet => inet
integer => int4
interval => interval
line => line
lseg => lseg
macaddr => macaddr
money => money
numeric => numeric
path => path
point => point
polygon => polygon
real => float4
smallint => int2
serial => int4
text => text
time => time
time with time zone => timetz
timestamp => timestamp
timestamp with time zone => timestamptz
And for the record... (note the 7.4 client lib)
# postmaster --version
postmaster (PostgreSQL) 8.0.4
# ldd libphp4.so
...
libpq.so.3 => /usr/lib/libpq.so.3 (0xb7ac8000)
...
pg_field_type
(PHP 4 >= 4.2.0, PHP 5)
pg_field_type — Retorna o nome do tipo para o campo de nome correspondente
Descrição
string pg_field_type
( resource $result
, int $field_number
)
pg_field_type() retorna uma string contendo o nome do tipo do campo de número field_number dado no recurso (resource) de resultado result . A numeração de campo inicia-se em 0.
Veja o exemplo dado na pagina pg_field_name().
Nota: Esta função era chamada pg_fieldtype().
Veja também pg_field_prtlen() e pg_field_type().
pg_field_type
marxarelli
02-Jan-2006 02:34
02-Jan-2006 02:34
andy at a 2 h d dot com
03-May-2003 12:09
03-May-2003 12:09
The types returned are:
bool
int2 (smallint)
int4
int8 (bigint)
numeric
float4 (real / float)
float8 (double)
timestamp
date
time
varchar
bpchar (fixed leng string, 'blank padded char')
inet (ip address)
money
There are some other more esoteric types, e.g. 'circle', but these are the most common.
