Document Upper Limit for NAMEDATELEN in pgsql 9.5+

Started by Kevin Dayover 10 years ago2 messagesdocs
Jump to latest
#1Kevin Day
thekevinday@gmail.com

Postgresql 9.5+ may now fail to compile if NAMEDATELEN has been set
absurdly large (In my case, 384).

The file src/backend/utils/adt/levenshtein.c does a static assert on
"NAMEDATALEN <= MAX_LEVENSHTEIN_STRLEN" with MAX_LEVENSHTEIN_STRLEN
currently set to 255.

When using a gcc version that does not support static asserts, the error
message looks like:
- "levenshtein.c:104: error: negative width in bit-field
'static_assert_failure'"

It would be great to be mention this new upper limit on NAMEDATALEN in the
documentation.

Here are some places I've looked at:
- src/include/pg_config_manual.h
- http://www.postgresql.org/docs/9.5/static/sql-syntax-lexical.html
- http://www.postgresql.org/docs/9.5/static/runtime-config-preset.html
- https://wiki.postgresql.org/wiki/Todo

While on the subject of NAMEDATALEN, there is a second undocumented place
where NAMEDATALEN is defined:
- src/interfaces/ecpg/include/sqlda-native.h

--
Kevin Day

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Kevin Day (#1)
Re: Document Upper Limit for NAMEDATELEN in pgsql 9.5+

Kevin Day <thekevinday@gmail.com> writes:

Postgresql 9.5+ may now fail to compile if NAMEDATELEN has been set
absurdly large (In my case, 384).
The file src/backend/utils/adt/levenshtein.c does a static assert on
"NAMEDATALEN <= MAX_LEVENSHTEIN_STRLEN" with MAX_LEVENSHTEIN_STRLEN
currently set to 255.

Hmm. I'm not sure whether 384 is "absurdly large", but I do wonder
why the levenshtein code gets to dictate limits on NAMEDATALEN at all.

Or to put it even more bluntly, I'm not sure that there is anything
whatever about MAX_LEVENSHTEIN_STRLEN that is well thought out. Why not
rip it out and put some CHECK_FOR_INTERRUPTS tests into the loops instead?

regards, tom lane

--
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs