sql: allow " as an escape character for COPY#52044
Closed
otan wants to merge 1 commit intocockroachdb:masterfrom
Closed
sql: allow " as an escape character for COPY#52044otan wants to merge 1 commit intocockroachdb:masterfrom
otan wants to merge 1 commit intocockroachdb:masterfrom
Conversation
Member
PostgreSQL allows `\\\"` as an escape for `\"`. However, we seem to not
allow it at all. This was a blocker for osm2pgsql.
In general, I think we should be allowing any non-captured escape to be
used as is, as PostgreSQL does:
```
otan=# \copy copytest from stdin
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself, or an EOF signal.
>> \1\2
>> COPY 1
otan=# select * from copytest
;
t
----------
\"
\x01\x02
(2 rows)
otan=# \copy copytest from stdin
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself, or an EOF signal.
>> \a
>> COPY 1
otan=# select * from copytest
;
t
----------
\"
\x01\x02
a
(3 rows)
otan=# \copy copytest from stdin
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself, or an EOF signal.
>> \b
>> COPY 1
otan=# select * from copytest
;
t
----------
\"
\x01\x02
a
\x08
(4 rows)
```
If you think we should change our code to follow this, let me know.
Release note: None
Contributor
|
From https://www.postgresql.org/docs/10/sql-copy.html:
This is the actual problem. Even though your PR would fix the |
Contributor
Author
|
sg! |
Contributor
|
I'm working on COPY on my Fridays so I'll fix this. |
Contributor
Author
|
well, saw this too late :P |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PostgreSQL allows
\\\"as an escape for\". However, we seem to notallow it at all. This was a blocker for osm2pgsql.
In general, I think we should be allowing any non-captured escape to be
used as is, as PostgreSQL does:
If you think we should change our code to follow this, let me know.
Release note: None