pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Document Upper Limit for NAMEDATELEN in pgsql 9.5+
2+ messages / 2 participants
[nested] [flat]

* Document Upper Limit for NAMEDATELEN in pgsql 9.5+
@ 2016-01-08 19:29  Kevin Day <thekevinday@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Kevin Day @ 2016-01-08 19:29 UTC (permalink / raw)
  To: pgsql-docs

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

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Document Upper Limit for NAMEDATELEN in pgsql 9.5+
@ 2016-01-08 19:49  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Kevin Day <thekevinday@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2016-01-08 19:49 UTC (permalink / raw)
  To: Kevin Day <thekevinday@gmail.com>; +Cc: pgsql-docs

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2016-01-08 19:49 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-01-08 19:29 Document Upper Limit for NAMEDATELEN in pgsql 9.5+ Kevin Day <thekevinday@gmail.com>
2016-01-08 19:49 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox