Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the removal of 'x' in "\x" corrupts data #23

Closed
mydimension opened this issue Aug 21, 2017 · 1 comment · Fixed by #40
Closed

the removal of 'x' in "\x" corrupts data #23

mydimension opened this issue Aug 21, 2017 · 1 comment · Fixed by #40

Comments

@mydimension
Copy link

I have data in a table the holds valid hex \x sequences (e.g. "\x1b" for an encoded [ESC] character). The following code in quote_escape_json seems to be the culprit:

/* XXX suppress \x in bytea field? */
if (ch == '\\' && *(valptr + 1) == 'x')
{
	valptr++;
	continue;
}

With this, my "\x1b" value is emitted from this plugin as "\1b".

Even if this is right thing to do for bytea values (not convinced it is), it is not correct for other textual data.

@eulerto
Copy link
Owner

eulerto commented Aug 21, 2017

I've already detected this problem while working in another patch. I'll fix it.

rcoup added a commit to koordinates/wal2json that referenced this issue Nov 15, 2017
* use the postgres builtin escape_json() function
* escape all type, schema, table, field names. Add a test. [eulerto#35]
* leave `\x` alone unless it's a bytea prefix [eulerto#23]
* escape generic logical decoding messages
rcoup added a commit to koordinates/wal2json that referenced this issue Nov 16, 2017
* use the postgres builtin escape_json() function
* escape all type, schema, table, field names. Add tests. [eulerto#35]
* leave `\x` alone unless it's a bytea prefix [eulerto#23]
* escape generic logical decoding messages with tests
rcoup added a commit to koordinates/wal2json that referenced this issue Nov 27, 2017
* use the postgres builtin escape_json() function
* escape all type, schema, table, field names. Add tests. [eulerto#35]
* leave `\x` alone unless it's a bytea prefix [eulerto#23]
* escape generic logical decoding messages with tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants