How long can PostgreSQL table names be?
According to PostgreSQL documentation :
identifiers ... identify the names of tables, columns, or other database objects ...
The system uses no more than
NAMEDATALEN-1
identifier bytes; longer names can be written in commands, but they will be truncated. The defaultNAMEDATALEN
is 64, so the maximum identifier length is 63 bytes.
You can see this limitation using the query suggested by this comment : SELECT length(repeat('xyzzy', 100)::NAME);
creates a 500 character string and sends it to PostgreSQL NAME
, then checks the length. The result is 63
.
source to share