Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PostgreSQL Clob datatype

Tags:

PostgreSQL supports both clob and text data types for storing large texts. I've used clob data type as we are migrating the DB from Oracle. I understand that the clob data type in PostgreSQL can only store up to 1GB of text rather than the 4GB in oracle.

Since my text size is well below 1GB, I am fine with using either of these types. So can I use PostgreSQL clob datatype or is there any advantage for text datatype over clob?

Any help will be much appreciated and Thanks in Advance.

like image 311
Tino M Thomas Avatar asked Apr 22 '18 07:04

Tino M Thomas


People also ask

Does PostgreSQL have CLOB?

PostgreSQL supports both clob and text data types for storing large texts.

Does Postgres support BLOB and CLOB?

Large Objects can also be handled in a more conventional manner using data types CLOB and BLOB. In Postgres, these data types are stored in a single system table called 'pg_largeobject' which has to be accessed via identifiers of data type OID which are stored with the table using BLOB/CLOB data.

What is CLOB in datatype?

A CLOB (character large object) value can be up to 2,147,483,647 characters long. A CLOB is used to store unicode character-based data, such as large documents in any character set.

What is the difference between VARCHAR2 and CLOB?

The difference between the 2 types is that in VARCHAR2 you have to specify the length of the stored string and that length is limited to 4000 characters while CLOB can store up to 128 terabytes of character data in the database.


1 Answers

The clob data type is unsupported in Postgres. However, it can be easily defined as a synonym to the text type:

create domain clob as text;
like image 103
klin Avatar answered Sep 17 '22 20:09

klin