2. Types Mappping

This is a quick guide to show how the PostgreSQL types are mapped into dbExpress types by the pgExpress Driver:

Table 2.1. 

PostgreSQL pgExpress Obs
int2   TSmallIntField
int4 TIntegerField int8
nt8 TLargeIntField The dbExpress™ technology does not have have native support for 64 bit integers; however, by using a hack, we provide native Int8 support.
char TStringField Fixed length.
varchar TStringField  
varchar TStringField  
varchar TStringField

TStringField.Size will be set to the maximum length. It's not adviced to set a maximum value too long in the table definition to keep the memory requirements low in the dbExpress™ row buffers.

If you want/need large values, try using the TEXT field type which maps into a BLOB/Memo (TMemoField) field. This field reads up to to 32kb (dbExpress™ limitation).

text TBLOBField/Memo Check our FAQ for more info on this. Text fields mapped as Memo will be faster and more efficient in terms of memory. You can also map them as strings (padded at 32Kb due to dbExpress™ limitation); check here.
numeric TBCDField VCL/CLX TBCDFields support up to 32 digits. If you have a field with more then that, it will get mapped as TStringField.
time TTimeField See note below. The time field type support fractions.
timetz TTimeField Timezones and second fractions aren't supported by VCL/CLX  and they can give your trouble when used in a WHERE clause on INSERT/UPDATE/DELETE queries. Please refer to our FAQ for more info on this. It's adviced to either don't use that info or don't use those fields on update queries ('Record not found or changed by another user' messages).
date TDateField  
timestamp TTimeStampField See note from fractions on the timetz field.
timestamptz TSQLTimeStampField See notes from timezones and fractions on the timetz field.
bool TBooleanField  
name TStringField Fixed length; name is a field type used internally by PostgreSQL.
bpchar TStringField Fixed length.
_bpchar TStringField Fixed length.
oid TIntegerField Integer
float4 TFloatField Actually TFloatField can support more precision and scale then float4 fields and are recommended. You can teorically have a overflow or underflow if someone tries to insert a bad value.
float8 TFloatField  
abstime/reltime TTimeField See note for time fields.
interval/tinterval TTimeStampField See note for time fields.
bytea TVarBytesField Reads up to 32kb (dbExpress™ limitation).
money TCurrencyField The money field is obsolete. The PostgreSQL documentation advices to use numeric or float8 fields instead.
lo TBlobField/Binary Following the PostgreSQL ODBC driver convention, the 'lo' field represents Large Objects. See the Large Objects section.
Other TStringField Unknown fields are mapped by default as Strings. You can turn this off (and thus don't use the fields at all) turning the MapUnknownAsString special param.