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

Add backslashed single quotes to grammar #262

Open
kislikjeka98 opened this issue Jul 10, 2024 · 3 comments
Open

Add backslashed single quotes to grammar #262

kislikjeka98 opened this issue Jul 10, 2024 · 3 comments

Comments

@kislikjeka98
Copy link

It breaks if use single quoted string with backslash escaped single quote, for example 'Author's name'.
But mysql and postgres accept it
https://dev.mysql.com/doc/refman/8.4/en/string-literals.html
https://www.postgresql.org/docs/current/sql-syntax-lexical.html

I think it can be fixed by changing single_quote grammar to this

{
	"_single_quote_string": {
		"type": "SEQ",
		"members": [
			{
				"type": "PATTERN",
				"value": "([uU]&)?'(''|[^'\\]|\\.)*'"
			},
			{
				"type": "REPEAT",
				"content": {
					"type": "PATTERN",
					"value": "'(''|[^'\\]|\\.)*'"
				}
			}
		]
	}
}

@matthias-Q
Copy link
Collaborator

This change is not enough, unfortunately. I have tested it and it breaks some tests (COPY FROM STDIN, because there a backslash can be set as an escape char)

@kislikjeka98
Copy link
Author

kislikjeka98 commented Jul 22, 2024

In my mind COMMENT used more frequiently than copy statements with EXCAPE ''
But i will think what to with this case

@matthias-Q
Copy link
Collaborator

matthias-Q commented Jul 22, 2024

Correct, but the parser work in all cases. I would really not like to remove functionality.

I did not had the time to look deeper into that issue.

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

No branches or pull requests

2 participants