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).
| Type in PostgreSQL | Maximum size |
|---|---|
TEXT | up 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 |
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.
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.
pg_dump -Fc (custom format restores bytea correctly) or COPY ... TO ... WITH (FORMAT binary)pg_restore, or COPY ... FROM ... WITH (FORMAT binary)pg_dump writes bytea as \x... hex literals, so the dump balloons - use -Fc when moving data between serversCOPY ... WITH (FORMAT binary) records the platform byte order in the file header, so restoring on a different architecture fails\x hex input/output form for BYTEA relies on standard_conforming_strings = on, which is the modern default