Skip to content

sql: allow escape of any character for COPY#52068

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
otan-cockroach:copy_allow_all
Jul 29, 2020
Merged

sql: allow escape of any character for COPY#52068
craig[bot] merged 1 commit intocockroachdb:masterfrom
otan-cockroach:copy_allow_all

Conversation

@otan
Copy link
Copy Markdown
Contributor

@otan otan commented Jul 29, 2020

According to the PostgreSQL docs:
Any other backslashed character that is not mentioned in the above
table will be taken to represent itself.

Reflect that change by converting error conditions from decodeCopy into
interpreting the characters as is.

Resolves #52067.

Release note (bug fix): COPY previously did not allow a backslash of
any character other than the special table set. CockroachDB would error
in these cases. This is changed to allow in any character after a
backslash and interpret it to mean the character itself as per PostgreSQL
(e.g. now \a will be interpreted as a). Furthermore, non hex-digits
following a \x is now interpreted without the backslash, (e.g. \xH as
xH). Strings ending with a single backslash will use the backslash
(e.g. x\\ is interpreted as x\).

@otan otan requested a review from madelynnblue July 29, 2020 17:23
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@otan otan force-pushed the copy_allow_all branch from 78c0fcb to 9c9b672 Compare July 29, 2020 17:30
According to the PostgreSQL docs:
  Any other backslashed character that is not mentioned in the above
  table will be taken to represent itself.

Reflect that change by converting error conditions from decodeCopy into
interpreting the characters as is.

Release note (bug fix): `COPY` previously did not allow a backslash of
any character other than the special table set. CockroachDB would error
in these cases. This is changed to allow in any character after a
backslash and interpret it to mean the character itself as per PostgreSQL
(e.g. now `\a` will be interpreted as `a`). Furthermore, non hex-digits
following a `\x` is now interpreted without the backslash, (e.g. `\xH` as
`xH`). Strings ending with a single backslash will use the backslash
(e.g. `x\\` is interpreted as `x\`).
@otan otan force-pushed the copy_allow_all branch from 9c9b672 to cecf0f3 Compare July 29, 2020 17:32
@otan
Copy link
Copy Markdown
Contributor Author

otan commented Jul 29, 2020

bors r=mjibson

1 similar comment
@otan
Copy link
Copy Markdown
Contributor Author

otan commented Jul 29, 2020

bors r=mjibson

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jul 29, 2020

Build succeeded:

@craig craig bot merged commit a22cc72 into cockroachdb:master Jul 29, 2020
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 this pull request may close these issues.

sql: improve COPY escape character handling

3 participants