postgresql/src
Tom Lane 4cbf390d5f Fix jsonb Unicode escape processing, and in consequence disallow \u0000.
We've been trying to support \u0000 in JSON values since commit
78ed8e03c6, and have introduced increasingly worse hacks to try to
make it work, such as commit 0ad1a81632.  However, it fundamentally
can't work in the way envisioned, because the stored representation looks
the same as for \\u0000 which is not the same thing at all.  It's also
entirely bogus to output \u0000 when de-escaped output is called for.

The right way to do this would be to store an actual 0x00 byte, and then
throw error only if asked to produce de-escaped textual output.  However,
getting to that point seems likely to take considerable work and may well
never be practical in the 9.4.x series.

To preserve our options for better behavior while getting rid of the nasty
side-effects of 0ad1a81632, revert that commit in toto and instead
throw error if \u0000 is used in a context where it needs to be de-escaped.
(These are the same contexts where non-ASCII Unicode escapes throw error
if the database encoding isn't UTF8, so this behavior is by no means
without precedent.)

In passing, make both the \u0000 case and the non-ASCII Unicode case report
ERRCODE_UNTRANSLATABLE_CHARACTER / "unsupported Unicode escape sequence"
rather than claiming there's something wrong with the input syntax.

Back-patch to 9.4, where we have to do something because 0ad1a81632
broke things for many cases having nothing to do with \u0000.  9.3 also has
bogus behavior, but only for that specific escape value, so given the lack
of field complaints it seems better to leave 9.3 alone.
2015-01-30 14:44:49 -05:00
..
backend Fix jsonb Unicode escape processing, and in consequence disallow \u0000. 2015-01-30 14:44:49 -05:00
bin Allow pg_dump to use jobs and serializable transactions together. 2015-01-30 08:57:53 -06:00
common Fix libpq's behavior when /etc/passwd isn't readable. 2015-01-11 12:35:47 -05:00
include Fix assorted oversights in range selectivity estimation. 2015-01-30 12:31:08 -05:00
interfaces Replace a bunch more uses of strncpy() with safer coding. 2015-01-24 13:05:45 -05:00
makefiles Remove USE_VPATH make variable from PGXS 2014-12-04 08:45:48 -05:00
pl Fix volatile-safety issue in pltcl_SPI_execute_plan(). 2015-01-26 12:18:36 -05:00
port Another attempt at fixing Windows Norwegian locale. 2015-01-16 13:10:06 +02:00
template Revert to using --enable-auto-import in Cygwin builds. 2014-02-16 15:14:04 -05:00
test Fix jsonb Unicode escape processing, and in consequence disallow \u0000. 2015-01-30 14:44:49 -05:00
timezone Add CST (China Standard Time) to our lists of timezone abbreviations. 2014-12-24 16:35:34 -05:00
tools Add pg_string_endswith as the start of a string helper library in src/common. 2015-01-03 20:54:13 +01:00
tutorial pgindent run for 9.4 2014-05-06 12:12:18 -04:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
bcc32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Create libpgcommon, and move pg_malloc et al to it 2013-02-12 11:21:05 -03:00
Makefile.global.in Fix installcheck case for tap tests 2014-12-24 10:32:02 -05:00
Makefile.shlib MinGW: Include .dll extension in .def file LIBRARY commands. 2014-10-27 19:59:52 -04:00
nls-global.mk Setup error context callback for transaction lock waits 2014-03-19 15:10:36 -03:00
win32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00