Home > OS >  Postgres truncates function names even though they are less than 63 characters
Postgres truncates function names even though they are less than 63 characters

Time:01-17

I have this issue with the latest pg admin where postgres is automatically truncating function names less than 63 characters. I don't know if it's related to language or something else, but here's a function name I'm using:

"βρες_ασθενείς_μίας_μέρας_νοσηλευτή"

postgres truncates the name to:

"βρες_ασθενείς_μίας_μέρας_νοσηλευτ"

which is 33 characters.

Did the rules of max function name size change or is there something wrong with my preferences?

Thanks for your time.

CodePudding user response:

"4.1.1. Identifiers and Key Words":

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.

Note that it says 63 bytes, not characters. If you use UTF-8, your untruncated string is 64 bytes long, which is too long. The truncated string is 62 bytes long and fits.

  •  Tags:  
  • Related