Skip to content

Commit 5fe8610

Browse files
committed
[spam] chang file structrue.
Signed-off-by: clundro <[email protected]>
1 parent 85bef31 commit 5fe8610

File tree

4 files changed

+16120
-16027
lines changed

4 files changed

+16120
-16027
lines changed

test/binder/binder_test.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,16 @@ TEST(BinderTest, BindBinaryOp) {
173173
PrintStatements(statements);
174174
}
175175

176-
TEST(BinderTest, DIABLED_BindCopyFrom) {
176+
TEST(BinderTest, DISABLED_BindCopyFrom) {
177177
auto statements = TryBind("copy from 'a.csv'");
178178
PrintStatements(statements);
179179
}
180180

181+
TEST(BinderTest, DISABLED_SelectFromCSV) {
182+
auto statements = TryBind("select * from 'a.csv'");
183+
PrintStatements(statements);
184+
}
185+
181186
// TODO(chi): subquery is not supported yet
182187
TEST(BinderTest, DISABLED_BindUncorrelatedSubquery) {
183188
auto statements = TryBind("select * from (select * from a) INNER JOIN (select * from b) ON a.x = b.y");

third_party/libpg_query/grammar/statements/copy.y

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,4 @@
1-
CopyStmt: COPY FROM copy_file_name
2-
{
3-
PGCopyStmt *n = makeNode(PGCopyStmt);
4-
n->relation = NULL;
5-
n->query = NULL;
6-
n->attlist = NIL;
7-
n->is_from = true;
8-
n->is_program = true;
9-
n->filename = $3;
10-
n->options = NIL;
11-
12-
if (n->is_program && n->filename == NULL)
13-
ereport(ERROR,
14-
(errcode(PG_ERRCODE_SYNTAX_ERROR),
15-
errmsg("COPYFROMFILE not allowed with NULL"),
16-
parser_errposition(@3)));
17-
18-
$$ = (PGNode *)n;
19-
}
20-
| COPY opt_binary qualified_name opt_column_list opt_oids
1+
CopyStmt: COPY opt_binary qualified_name opt_column_list opt_oids
212
copy_from opt_program copy_file_name copy_delimiter opt_with copy_options
223
{
234
PGCopyStmt *n = makeNode(PGCopyStmt);
@@ -63,6 +44,25 @@ CopyStmt: COPY FROM copy_file_name
6344
errmsg("STDIN/STDOUT not allowed with PROGRAM"),
6445
parser_errposition(@5)));
6546

47+
$$ = (PGNode *)n;
48+
}
49+
| COPY FROM copy_file_name
50+
{
51+
PGCopyStmt *n = makeNode(PGCopyStmt);
52+
n->relation = NULL;
53+
n->query = NULL;
54+
n->attlist = NIL;
55+
n->is_from = true;
56+
n->is_program = false;
57+
n->filename = $3;
58+
n->options = NIL;
59+
60+
if (n->filename == NULL)
61+
ereport(ERROR,
62+
(errcode(PG_ERRCODE_SYNTAX_ERROR),
63+
errmsg("COPYFROMFILE not allowed with NULL"),
64+
parser_errposition(@3)));
65+
6666
$$ = (PGNode *)n;
6767
}
6868
;

0 commit comments

Comments
 (0)