HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

What is the maximum length of a comment in PostgreSQL?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
commentpostgresqlthemaximumwhatlength

Problem

PostgreSQL has a special piece of a functionality called COMMENT which attaches metadata to an identifier or any type (schema, table, column, function, type, domain, etc). It looks like this,

COMMENT ON TABLE mytable IS 'This is my table.';


Is there a maximum size for the comment?

Solution

COMMENT has no impositions other than it fit into a TEXT field (verified in IRC with RhodiumToad),

From the docs,


Very long values are also stored in background tables so that they do not interfere with rapid access to shorter column values. In any case, the longest possible character string that can be stored is about 1 GB.

So if you're under a GB or thereabout, you're probably fine.

Context

StackExchange Database Administrators Q#230732, answer score: 8

Revisions (0)

No revisions yet.