Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maximum size of "TEXT" datatype in postgresql

I am working with python.

I have a field with "text" datatype in postgres. Whenever I try to save a very large string, it throws internal error in python, but if I save the string with a smaller size, it saves it properly.

I don't understand the problem. Is it that there is some maximum limit for entering the characters for "TEXT" datatype?

like image 551
user977933 Avatar asked May 01 '12 09:05

user977933


People also ask

What is text data type in PostgreSQL?

PostgreSQL supports a character data type called TEXT. This data type is used to store character of unlimited length. It is represented as text in PostgreSQL. The performance of the varchar (without n) and text are the same. Syntax: variable_name TEXT.

Should I use text or VARCHAR in Postgres?

Different from other database systems, in PostgreSQL, there is no performance difference among three character types. In most cases, you should use TEXT or VARCHAR . And you use the VARCHAR(n) when you want PostgreSQL to check for the length.

What is maximum length of character varying Postgres?

The maximum limit of size character using character varying data type in PostgreSQL is 10485760. The below example shows that the size of the character using character varying data type in PostgreSQL is 10485760.


1 Answers

From the manual:

In any case, the longest possible character string that can be stored is about 1 GB.

like image 115
Frank Heikens Avatar answered Sep 29 '22 21:09

Frank Heikens