Skip to content

Commit e99146b

Browse files
committed
fix: make copy a dml statement for qualify_tables
1 parent 19370d5 commit e99146b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

sqlglot/expressions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2015,7 +2015,7 @@ class CopyParameter(Expression):
20152015
arg_types = {"this": True, "expression": False, "expressions": False}
20162016

20172017

2018-
class Copy(Expression):
2018+
class Copy(DML):
20192019
arg_types = {
20202020
"this": True,
20212021
"kind": True,

tests/fixtures/optimizer/qualify_tables.sql

+3
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,6 @@ SELECT a.id, a_2.id FROM c.db1.a AS a JOIN c.db2.a AS a_2 ON a.id = a_2.id;
177177

178178
SELECT cat.db1.a.id, db2.a.id FROM cat.db1.a JOIN db2.a ON cat.db1.a.id = db2.a.id;
179179
SELECT a.id, a_2.id FROM cat.db1.a AS a JOIN c.db2.a AS a_2 ON a.id = a_2.id;
180+
181+
COPY INTO (SELECT * FROM x) TO 'data' WITH (FORMAT 'CSV');
182+
COPY INTO (SELECT * FROM c.db.x AS x) TO 'data' WITH (FORMAT 'CSV');

0 commit comments

Comments
 (0)