In fact you can extract the size of the varchar field, by simply sending the following query:"select a.atttypmod,a.attrelid from pg_attribute as a, pg_class as c where c.relname='$table' AND a.attrelid=c.oid AND a.attname='$field'"here is a simple function that does that:function get_field_size($table, $field, $link) { $result = pg_query($link, "select a.atttypmod,a.attrelid from pg_attribute as a, pg_class as c where c.relname='$table' AND a.attrelid=c.oid AND a.attname='$field'"); $data = pg_fetch_object($result); return ($data->atttypmod - 4); }returned value is a size of a given field (also varchar)