Add support for parsing COPY statements from STDIN without a semicolon#2245
Open
LucaCappelletti94 wants to merge 1 commit intoapache:mainfrom
Open
Add support for parsing COPY statements from STDIN without a semicolon#2245LucaCappelletti94 wants to merge 1 commit intoapache:mainfrom
LucaCappelletti94 wants to merge 1 commit intoapache:mainfrom
Conversation
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.
This PR fixes PostgreSQL
COPY ... FROM STDINparsing when the statement ends at EOF without a trailing semicolon.This is one of several failure families I have found in the course of the correctness benchmarks I am running based on resources such as the PostgreSQL regression SQL suite.
Before this change, sqlparser rejected valid inputs such as:
with:
Root Cause
parse_copyunconditionally required;forCopyTarget::Stdinbefore reading optional inline payload rows.Fix
For
COPY ... FROM STDIN:EOFas a valid terminator when no inline payload is presentTests
Added/updated PostgreSQL regression coverage:
parse_copy_from_stdin_without_semicolonparse_copy_from_stdin_without_semicolon_variantsThe variants cover multiple
FROM stdinshapes without trailing semicolon (columns, legacy options, mixed casing), and assert they parse asStatement::Copywithtarget: Stdinand empty payload.