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 | |
oid | TIntegerField | As of pgExpress 4.30, OID fields will always be mapped and int4 to avoid confusion with Large Objects |
int8 | TLargeIntField/TStringField/TIntField |
The dbExpress technology does not have native support for 64 bit
integers; however, by using a hack, we provide native Int8 support.
Please note the TIndexDef issues associated with native Int8 usage in the link
here. This mapping is controlled by the
Int8Mode Special Param.
|
char | TStringField | Fixed length. The same UNICODE/WideChar notes from varchar type apply. |
varchar | TStringField/TWideString |
If you want/need large values, try using the TEXT field type which maps into a
BLOB/Memo ( varchar fields with no size specifier is identical to a text field and will be mapped in pgExpress just as a text field. |
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. |
XML | TBLOBField/Memo | See notes for text fields. |
JSON | TBLOBField/Memo | New type from PostgreSQL v9.2. |
numeric | TFMTBCDField | VCL/CLX TFMTBCDFields support up to 32 digits. If you have a field with more then that, it will get mapped as TStringField.Note: TFMTBCDField is used instead of TBCDField because it allows greater precision. |
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. |
date | TDateField | Timezones are not supported by VCL/CLX |
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 | TStringField | Since there is no interval type in VCL, we have to map these types as strings. |
bytea | TVarBytesField, Blob/Graphic or Blob/binary | See ByteaMode Special Param. TVarBytesFieldReads 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. Consider using Bytea fields as BLOBs instead. |
Other | TStringField | Unknown fields are mapped by default as Strings. You can turn this off (and thus don't use the fields at all) by toggling the MapUnknownAsString special param. |