Skip to content

Commit

Permalink
[spam] chang file structrue.
Browse files Browse the repository at this point in the history
Signed-off-by: clundro <[email protected]>
  • Loading branch information
infdahai committed Mar 28, 2023
1 parent 85bef31 commit 5fe8610
Show file tree
Hide file tree
Showing 4 changed files with 16,120 additions and 16,027 deletions.
7 changes: 6 additions & 1 deletion test/binder/binder_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,16 @@ TEST(BinderTest, BindBinaryOp) {
PrintStatements(statements);
}

TEST(BinderTest, DIABLED_BindCopyFrom) {
TEST(BinderTest, DISABLED_BindCopyFrom) {
auto statements = TryBind("copy from 'a.csv'");
PrintStatements(statements);
}

TEST(BinderTest, DISABLED_SelectFromCSV) {
auto statements = TryBind("select * from 'a.csv'");
PrintStatements(statements);
}

// TODO(chi): subquery is not supported yet
TEST(BinderTest, DISABLED_BindUncorrelatedSubquery) {
auto statements = TryBind("select * from (select * from a) INNER JOIN (select * from b) ON a.x = b.y");
Expand Down
40 changes: 20 additions & 20 deletions third_party/libpg_query/grammar/statements/copy.y
Original file line number Diff line number Diff line change
@@ -1,23 +1,4 @@
CopyStmt: COPY FROM copy_file_name
{
PGCopyStmt *n = makeNode(PGCopyStmt);
n->relation = NULL;
n->query = NULL;
n->attlist = NIL;
n->is_from = true;
n->is_program = true;
n->filename = $3;
n->options = NIL;

if (n->is_program && n->filename == NULL)
ereport(ERROR,
(errcode(PG_ERRCODE_SYNTAX_ERROR),
errmsg("COPYFROMFILE not allowed with NULL"),
parser_errposition(@3)));

$$ = (PGNode *)n;
}
| COPY opt_binary qualified_name opt_column_list opt_oids
CopyStmt: COPY opt_binary qualified_name opt_column_list opt_oids
copy_from opt_program copy_file_name copy_delimiter opt_with copy_options
{
PGCopyStmt *n = makeNode(PGCopyStmt);
Expand Down Expand Up @@ -63,6 +44,25 @@ CopyStmt: COPY FROM copy_file_name
errmsg("STDIN/STDOUT not allowed with PROGRAM"),
parser_errposition(@5)));

$$ = (PGNode *)n;
}
| COPY FROM copy_file_name
{
PGCopyStmt *n = makeNode(PGCopyStmt);
n->relation = NULL;
n->query = NULL;
n->attlist = NIL;
n->is_from = true;
n->is_program = false;
n->filename = $3;
n->options = NIL;

if (n->filename == NULL)
ereport(ERROR,
(errcode(PG_ERRCODE_SYNTAX_ERROR),
errmsg("COPYFROMFILE not allowed with NULL"),
parser_errposition(@3)));

$$ = (PGNode *)n;
}
;
Expand Down
Loading

0 comments on commit 5fe8610

Please sign in to comment.