postgres/src/backend
Tom Lane 47acf3add3 Remove new coupling between NAMEDATALEN and MAX_LEVENSHTEIN_STRLEN.
Commit e529cd4ffa introduced an Assert requiring NAMEDATALEN to be
less than MAX_LEVENSHTEIN_STRLEN, which has been 255 for a long time.
Since up to that instant we had always allowed NAMEDATALEN to be
substantially more than that, this was ill-advised.

It's debatable whether we need MAX_LEVENSHTEIN_STRLEN at all (versus
putting a CHECK_FOR_INTERRUPTS into the loop), or whether it has to be
so tight; but this patch takes the narrower approach of just not applying
the MAX_LEVENSHTEIN_STRLEN limit to calls from the parser.

Trusting the parser for this seems reasonable, first because the strings
are limited to NAMEDATALEN which is unlikely to be hugely more than 256,
and second because the maximum distance is tightly constrained by
MAX_FUZZY_DISTANCE (though we'd forgotten to make use of that limit in one
place).  That means the cost is not really O(mn) but more like O(max(m,n)).

Relaxing the limit for user-supplied calls is left for future research;
given the lack of complaints to date, it doesn't seem very high priority.

In passing, fix confusion between lengths-in-bytes and lengths-in-chars
in comments and error messages.

Per gripe from Kevin Day; solution suggested by Robert Haas.  Back-patch
to 9.5 where the unwanted restriction was introduced.
2016-01-22 11:53:06 -05:00
..
access Fix overly-strict assertions in spgtextproc.c. 2016-01-02 16:24:59 -05:00
bootstrap pgindent run for 9.5 2015-05-23 21:35:49 -04:00
catalog Split out pg_operator.h function declarations to new file pg_operator_fn.h. 2016-01-01 13:00:13 -05:00
commands Fix bogus lock release in RemovePolicyById and RemoveRoleFromObjectPolicy. 2016-01-03 20:53:41 -05:00
executor Improve some messages 2015-12-10 22:05:43 -05:00
foreign Code review for foreign/custom join pushdown patch. 2015-05-10 14:36:36 -04:00
lib Avoid use of float arithmetic in bipartite_match.c. 2015-08-23 13:02:19 -04:00
libpq Properly close token in sspi authentication 2016-01-14 13:07:20 +01:00
main Revoke support for strxfrm() that write past the specified array length. 2015-07-08 20:44:25 -04:00
nodes Add defenses against putting expanded objects into Const nodes. 2016-01-21 12:55:59 -05:00
optimizer Add defenses against putting expanded objects into Const nodes. 2016-01-21 12:55:59 -05:00
parser Remove new coupling between NAMEDATALEN and MAX_LEVENSHTEIN_STRLEN. 2016-01-22 11:53:06 -05:00
po Translation updates 2016-01-04 08:18:48 -05:00
port Fix treatment of *lpNumberOfBytesRecvd == 0: that's a completion condition. 2016-01-03 13:56:29 -05:00
postmaster Message improvements 2015-11-16 21:16:42 -05:00
regex Fix enforcement of restrictions inside regexp lookaround constraints. 2015-11-07 12:43:24 -05:00
replication Clean up some lack-of-STRICT issues in the core code, too. 2016-01-09 16:58:32 -05:00
rewrite Put back one copyObject() in rewriteTargetView(). 2015-12-29 16:46:01 -05:00
snowball Remove no-longer-required function declarations. 2015-05-24 12:20:23 -04:00
storage Correct statement to actually be the intended assert statement. 2015-12-14 11:25:04 +01:00
tcop Message style improvements 2015-10-28 20:23:53 -04:00
tsearch pgindent run for 9.5 2015-05-23 21:35:49 -04:00
utils Remove new coupling between NAMEDATALEN and MAX_LEVENSHTEIN_STRLEN. 2016-01-22 11:53:06 -05:00
.gitignore
common.mk Remove maintainer-check target, fold into normal build 2013-10-10 20:11:56 -04:00
Makefile AIX: Link the postgres executable with -Wl,-brtllib. 2015-07-15 21:00:30 -04:00
nls.mk Translation updates 2015-02-01 23:23:40 -05:00