PostgreSQL CLOB Tools - Import, Export, View and Edit

In PostgreSQL, there isn’t a direct equivalent of the CLOB (Character Large Object) type like in some other database systems such as DB2 or Oracle. However, PostgreSQL provides data types that can be used to handle large amounts of character data, mainly the TEXT type. More: PostgreSQL TEXT (CLOB).

PostgreSQL CLOB - type family and size limits

Type in PostgreSQLMaximum size
TEXTup to 1 GB, no length argument, recommended
VARCHAR(n)length-limited; an overlong value raises an error instead of truncating
CHAR(n)blank-padded fixed width, rarely what you want

CLOB versus BLOB in PostgreSQL

PostgreSQL has no BLOB or CLOB type names either: binary goes in `BYTEA` and characters go in `TEXT`. Both reach 1 GB. Only if you genuinely need multi-terabyte objects should you turn to OID-based large objects.

What limits you first

TOAST usually bites first: any value over roughly 2 KB is compressed and moved into a side table. The 1 GB type limit is rarely reached, but TOAST has a visible cost in read performance and backup size.

CLOB from the command line

Things that bite with CLOB in PostgreSQL