postgresql/src/test
Tom Lane c54159d44c Make locale-dependent regex character classes work for large char codes.
Previously, we failed to recognize Unicode characters above U+7FF as
being members of locale-dependent character classes such as [[:alpha:]].
(Actually, the same problem occurs for large pg_wchar values in any
multibyte encoding, but UTF8 is the only case people have actually
complained about.)  It's impractical to get Spencer's original code to
handle character classes or ranges containing many thousands of characters,
because it insists on considering each member character individually at
regex compile time, whether or not the character will ever be of interest
at run time.  To fix, choose a cutoff point MAX_SIMPLE_CHR below which
we process characters individually as before, and deal with entire ranges
or classes as single entities above that.  We can actually make things
cheaper than before for chars below the cutoff, because the color map can
now be a simple linear array for those chars, rather than the multilevel
tree structure Spencer designed.  It's more expensive than before for
chars above the cutoff, because we must do a binary search in a list of
high chars and char ranges used in the regex pattern, plus call iswalpha()
and friends for each locale-dependent character class used in the pattern.
However, multibyte encodings are normally designed to give smaller codes
to popular characters, so that we can expect that the slow path will be
taken relatively infrequently.  In any case, the speed penalty appears
minor except when we have to apply iswalpha() etc. to high character codes
at runtime --- and the previous coding gave wrong answers for those cases,
so whether it was faster is moot.

Tom Lane, reviewed by Heikki Linnakangas

Discussion: <15563.1471913698@sss.pgh.pa.us>
2016-09-05 17:06:29 -04:00
..
examples Update copyright for 2016 2016-01-02 13:33:40 -05:00
isolation Fix a bunch of places that called malloc and friends with no NULL check. 2016-08-30 18:22:43 -04:00
locale Fix omission of -X (--no-psqlrc) in some psql invocations. 2015-12-28 11:46:43 -05:00
mb Revert "Fix broken multibyte regression tests." 2016-01-26 08:29:15 +09:00
modules Final pgindent + perltidy run for 9.6. 2016-08-15 13:42:51 -04:00
perl Final pgindent + perltidy run for 9.6. 2016-08-15 13:42:51 -04:00
recovery Dirty replication slots when using sql interface 2016-09-05 09:44:38 +01:00
regress Make locale-dependent regex character classes work for large char codes. 2016-09-05 17:06:29 -04:00
ssl Clean the last few TAP suite tmp_check directories. 2016-02-24 23:41:54 -05:00
thread Update copyright for 2016 2016-01-02 13:33:40 -05:00
Makefile Add a test framework for recovery 2016-02-26 16:13:30 -03:00
README Minor tweaks for new src/test/recovery 2016-02-29 18:16:59 -03:00

README

PostgreSQL tests
================

This directory contains a variety of test infrastructure as well as some of the
tests in PostgreSQL. Not all tests are here -- in particular, there are more in
individual contrib/ modules and in src/bin.

Not all these tests get run by "make check". Check src/test/Makefile to see
which tests get run automatically.

examples/
  Demonstration programs for libpq that double as regression tests via
  "make check"

isolation/
  Tests for concurrent behavior at the SQL level

locale/
  Sanity checks for locale data, encodings, etc

mb/
  Tests for multibyte encoding (UTF-8) support

modules/
  Extensions used only or mainly for test purposes, generally not suitable
  for installing in production databases

perl/
  Infrastructure for Perl-based TAP tests

recovery/
  Test suite for recovery and replication

regress/
  PostgreSQL's main regression test suite, pg_regress

ssl/
  Tests to exercise and verify SSL certificate handling

thread/
  A thread-safety-testing utility used by configure