Start new line if \r in Postgres dialect#1647
Merged
iffyio merged 2 commits intoapache:mainfrom Jan 7, 2025
Merged
Conversation
Currently the tokenizer throws an error for
insert into cats_2 (petname) values ('foo'),--\r(version()||'\n');
this is because postgres treats \r as a separate new line character, see https://github.com/postgres/postgres/blob/master/src/backend/parser/scan.l
> In order to make the world safe for Windows and Mac clients as well as Unix ones, we accept either \n or \r as a newline.
> A DOS-style \r\n sequence will be seen as two successive newlines, but that doesn't cause any problems.
> non_newline [^\n\r]
> comment ("--"{non_newline}*)
Let's make sure we start a new line if we encounter a \r when tokenizing a comment.
…o patch-carriage-return * 'main' of github.com:hansott/datafusion-sqlparser-rs: Add support for MySQL's INSERT INTO ... SET syntax (apache#1641) Add support for Snowflake LIST and REMOVE (apache#1639) Add support for the SQL OVERLAPS predicate (apache#1638) Add support for various Snowflake grantees (apache#1640) Add support for USE SECONDARY ROLE (vs. ROLES) (apache#1637) Correctly tokenize nested comments (apache#1629) Add support for MYSQL's `RENAME TABLE` (apache#1616) Test benchmarks and Improve benchmark README.md (apache#1627)
iffyio
approved these changes
Jan 7, 2025
ayman-sigma
pushed a commit
to sigmacomputing/sqlparser-rs
that referenced
this pull request
Apr 10, 2025
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.
Currently the tokenizer throws an error for
this is because postgres treats \r as a separate new line character, see https://github.com/postgres/postgres/blob/master/src/backend/parser/scan.l
Let's make sure we start a new line if we encounter a \r when tokenizing a comment.