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

Invalid JSON is generated for quoted identifiers #35

Closed
jpechane opened this issue Nov 9, 2017 · 1 comment
Closed

Invalid JSON is generated for quoted identifiers #35

jpechane opened this issue Nov 9, 2017 · 1 comment

Comments

@jpechane
Copy link

@jpechane jpechane commented Nov 9, 2017

When a qutoed identifiers are used - like when a table name contains space - then the JSON generator is not escaping the quotes and as a result the JSON is invalid.

@rcoup

This comment has been minimized.

Copy link
Contributor

@rcoup rcoup commented Nov 15, 2017

To reproduce:

CREATE TABLE "foo""' bar" (
    id integer NOT NULL,
    "more ""'quoting" integer
);
INSERT INTO "foo""' bar" VALUES (1,2);

Produces (pg_recvlogical):

{
	"change": [
		{
			"kind": "insert",
			"schema": "public",
			"table": "foo"' bar",
			"columnnames": ["id", "more "'quoting"],
			"columntypes": ["integer", "integer"],
			"columnvalues": [1, 2]
		}
	]
}

AFAICT it should be "table": "foo\"' bar", and , "more \"'quoting"],

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
@eulerto eulerto closed this in #40 Mar 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.