Reputation: 375
I need create function with specific name (more then 63 characters). And I have this message in IDE
Identifier is too long (should not exceed 63 characters)
When I created function name is truncated. Is any method to create identifier more then 63 characters?
Upvotes: 1
Views: 3063
Reputation: 311
Since this has been answered by @bill-karwin, but allow us to add more insights to this.
Ideally, changing the NAMEDATALEN which can be done by manually changing the value specified in the source code file src/include/pg_config_manual.h Take note that its default value is 65. See here for reference.
However, doing this yields an undesirable effect. Certain actions has to be done, you need the postgres to be recompiled, data directory initialized with initdb and data restored. Those security and bugfix patches for minor release means you have to recompile it again just for the sake of this long identifier you have which can be mitigated simply and easily. If you sacrifice those actions just for the identifier sounds likely absurd. But anyhow, doing this,
You have two options:
1.) compile the PostgreSQL software from source and increase that limit we don’t recommend,
2.) use shorter object names (table-, view-, sequence-, column-, whatever names) with a maximum length of 63 characters.
Upvotes: 1
Reputation: 562368
https://www.postgresql.org/docs/current/sql-syntax-lexical.html says:
The system uses no more than NAMEDATALEN-1 bytes of an identifier; longer names can be written in commands, but they will be truncated. By default, NAMEDATALEN is 64 so the maximum identifier length is 63 bytes. If this limit is problematic, it can be raised by changing the NAMEDATALEN constant in
src/include/pg_config_manual.h
.
In other words, you can increase the limit if you change the code of PostgreSQL and build a custom binary.
I would choose a different name for the function.
Upvotes: 7