
December 24th, 2001, 04:25 AM
|
|
Contributing User
|
|
Join Date: Jun 2000
Posts: 114
Time spent in forums: < 1 sec
Reputation Power: 13
|
|
For variable length fields, you need to check the atttypmod field. Postgres will add four more bytes (presumably to hold the actual size of the data?). For example, if a column is varchar(25), its value in atttypmod will be 29. By the way, in case your interested, the PHP function pg_fieldsize will only ever return '-1' for varchar fields, which I think is pretty weak. Fortunately it's a simple fix, just patch <php_4.1_source>/ext/pgsql/pgsql.c with this:
Code:
1018a1019,1021
> if ( return_value->value.lval == -1 )
> return_value->value.lval = PQfmod( pgsql_result, Z_LVAL_PP(field) );
>
Sorry, just noticed the other part of your post: check out the online manual at http://www.postgresql.org/idocs/index.php?catalogs.html (I think there's even a mirror in Britain.)
Last edited by billyo : December 24th, 2001 at 04:30 AM.
|