Skip to content

Commit 367b51a

Browse files
committed
parser: remove IMPORT TABLE and IMPORT non-INTO support
PGDUMP and MYSQLDUMP code is now being removed, so remove the parser support. Release note (sql change): IMPORT TABLE as well PGDUMP and MYSQLDUMP formats of IMPORT are now fully removed. These have been deprecated since 23.2.
1 parent be2cc31 commit 367b51a

File tree

5 files changed

+22
-115
lines changed

5 files changed

+22
-115
lines changed
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
import_stmt ::=
2-
'IMPORT' import_format file_location 'WITH' kv_option_list
3-
| 'IMPORT' import_format file_location
4-
| 'IMPORT' 'TABLE' table_name 'FROM' import_format file_location 'WITH' kv_option_list
5-
| 'IMPORT' 'TABLE' table_name 'FROM' import_format file_location
6-
| 'IMPORT' 'INTO' table_name '(' insert_column_list ')' import_format 'DATA' '(' file_location ( ( ',' file_location ) )* ')' 'WITH' kv_option_list
2+
'IMPORT' 'INTO' table_name '(' insert_column_list ')' import_format 'DATA' '(' file_location ( ( ',' file_location ) )* ')' 'WITH' kv_option_list
73
| 'IMPORT' 'INTO' table_name '(' insert_column_list ')' import_format 'DATA' '(' file_location ( ( ',' file_location ) )* ')'
84
| 'IMPORT' 'INTO' table_name import_format 'DATA' '(' file_location ( ( ',' file_location ) )* ')' 'WITH' kv_option_list
95
| 'IMPORT' 'INTO' table_name import_format 'DATA' '(' file_location ( ( ',' file_location ) )* ')'

docs/generated/sql/bnf/stmt_block.bnf

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,7 @@ explain_stmt ::=
238238
| 'EXPLAIN' 'ANALYSE' '(' explain_option_list ')' explainable_stmt
239239

240240
import_stmt ::=
241-
'IMPORT' import_format string_or_placeholder opt_with_options
242-
| 'IMPORT' 'TABLE' table_name 'FROM' import_format string_or_placeholder opt_with_options
243-
| 'IMPORT' 'INTO' table_name '(' insert_column_list ')' import_format 'DATA' '(' string_or_placeholder_list ')' opt_with_options
241+
'IMPORT' 'INTO' table_name '(' insert_column_list ')' import_format 'DATA' '(' string_or_placeholder_list ')' opt_with_options
244242
| 'IMPORT' 'INTO' table_name import_format 'DATA' '(' string_or_placeholder_list ')' opt_with_options
245243

246244
insert_stmt ::=
@@ -719,24 +717,20 @@ explainable_stmt ::=
719717
explain_option_list ::=
720718
( explain_option_name ) ( ( ',' explain_option_name ) )*
721719

720+
insert_column_list ::=
721+
( insert_column_item ) ( ( ',' insert_column_item ) )*
722+
722723
import_format ::=
723724
name
724725

725-
string_or_placeholder ::=
726-
non_reserved_word_or_sconst
727-
| 'PLACEHOLDER'
726+
string_or_placeholder_list ::=
727+
( string_or_placeholder ) ( ( ',' string_or_placeholder ) )*
728728

729729
opt_with_options ::=
730730
'WITH' kv_option_list
731731
| 'WITH' 'OPTIONS' '(' kv_option_list ')'
732732
|
733733

734-
insert_column_list ::=
735-
( insert_column_item ) ( ( ',' insert_column_item ) )*
736-
737-
string_or_placeholder_list ::=
738-
( string_or_placeholder ) ( ( ',' string_or_placeholder ) )*
739-
740734
insert_target ::=
741735
table_name_opt_idx
742736
| table_name_opt_idx 'AS' table_alias_name
@@ -775,6 +769,10 @@ reset_session_stmt ::=
775769
reset_csetting_stmt ::=
776770
'RESET' 'CLUSTER' 'SETTING' var_name
777771

772+
string_or_placeholder ::=
773+
non_reserved_word_or_sconst
774+
| 'PLACEHOLDER'
775+
778776
opt_with_restore_options ::=
779777
'WITH' restore_options_list
780778
| 'WITH' 'OPTIONS' '(' restore_options_list ')'
@@ -2032,16 +2030,12 @@ drop_policy_stmt ::=
20322030
explain_option_name ::=
20332031
non_reserved_word
20342032

2035-
non_reserved_word_or_sconst ::=
2036-
non_reserved_word
2037-
| 'SCONST'
2033+
insert_column_item ::=
2034+
column_name
20382035

20392036
kv_option_list ::=
20402037
( kv_option ) ( ( ',' kv_option ) )*
20412038

2042-
insert_column_item ::=
2043-
column_name
2044-
20452039
session_var ::=
20462040
'identifier'
20472041
| 'identifier' session_var_parts
@@ -2059,6 +2053,10 @@ var_name ::=
20592053
name
20602054
| name attrs
20612055

2056+
non_reserved_word_or_sconst ::=
2057+
non_reserved_word
2058+
| 'SCONST'
2059+
20622060
restore_options_list ::=
20632061
( restore_options ) ( ( ',' restore_options ) )*
20642062

@@ -2925,15 +2923,15 @@ non_reserved_word ::=
29252923
| col_name_keyword
29262924
| type_func_name_keyword
29272925

2926+
column_name ::=
2927+
name
2928+
29282929
kv_option ::=
29292930
name '=' string_or_placeholder
29302931
| name
29312932
| 'SCONST' '=' string_or_placeholder
29322933
| 'SCONST'
29332934

2934-
column_name ::=
2935-
name
2936-
29372935
session_var_parts ::=
29382936
( '.' 'identifier' ) ( ( '.' 'identifier' ) )*
29392937

pkg/sql/parser/help_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ func TestContextualHelp(t *testing.T) {
591591
{`RESTORE foo FROM LATEST IN '/bar' ??`, `RESTORE`},
592592
{`RESTORE DATABASE ??`, `RESTORE`},
593593

594-
{`IMPORT TABLE ??`, `IMPORT`},
594+
{`IMPORT INTO ??`, `IMPORT`},
595595

596596
{`EXPORT ??`, `EXPORT`},
597597
{`EXPORT INTO CSV 'a' ??`, `EXPORT`},

pkg/sql/parser/sql.y

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4136,45 +4136,12 @@ alter_unsupported_stmt:
41364136
// %Help: IMPORT - load data from file in a distributed manner
41374137
// %Category: CCL
41384138
// %Text:
4139-
// -- Import both schema and table data:
4140-
// IMPORT [ TABLE <tablename> FROM ]
4141-
// <format> <datafile>
4142-
// [ WITH <option> [= <value>] [, ...] ]
4143-
//
4144-
// Formats:
4145-
// MYSQLDUMP
4146-
// PGDUMP
4147-
//
4148-
// Options:
4149-
// distributed = '...'
4150-
// temp = '...'
4151-
//
41524139
// Use CREATE TABLE followed by IMPORT INTO to create and import into a table
41534140
// from external files that only have table data.
41544141
//
41554142
// %SeeAlso: CREATE TABLE, WEBDOCS/import-into.html
41564143
import_stmt:
4157-
IMPORT import_format '(' string_or_placeholder ')' opt_with_options
4158-
{
4159-
/* SKIP DOC */
4160-
$$.val = &tree.Import{Bundle: true, FileFormat: $2, Files: tree.Exprs{$4.expr()}, Options: $6.kvOptions()}
4161-
}
4162-
| IMPORT import_format string_or_placeholder opt_with_options
4163-
{
4164-
$$.val = &tree.Import{Bundle: true, FileFormat: $2, Files: tree.Exprs{$3.expr()}, Options: $4.kvOptions()}
4165-
}
4166-
| IMPORT TABLE table_name FROM import_format '(' string_or_placeholder ')' opt_with_options
4167-
{
4168-
/* SKIP DOC */
4169-
name := $3.unresolvedObjectName().ToTableName()
4170-
$$.val = &tree.Import{Bundle: true, Table: &name, FileFormat: $5, Files: tree.Exprs{$7.expr()}, Options: $9.kvOptions()}
4171-
}
4172-
| IMPORT TABLE table_name FROM import_format string_or_placeholder opt_with_options
4173-
{
4174-
name := $3.unresolvedObjectName().ToTableName()
4175-
$$.val = &tree.Import{Bundle: true, Table: &name, FileFormat: $5, Files: tree.Exprs{$6.expr()}, Options: $7.kvOptions()}
4176-
}
4177-
| IMPORT INTO table_name '(' insert_column_list ')' import_format DATA '(' string_or_placeholder_list ')' opt_with_options
4144+
IMPORT INTO table_name '(' insert_column_list ')' import_format DATA '(' string_or_placeholder_list ')' opt_with_options
41784145
{
41794146
name := $3.unresolvedObjectName().ToTableName()
41804147
$$.val = &tree.Import{Table: &name, Into: true, IntoCols: $5.nameList(), FileFormat: $7, Files: $10.exprs(), Options: $12.kvOptions()}

pkg/sql/parser/testdata/import_export

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
parse
2-
IMPORT TABLE foo FROM PGDUMPCREATE 'nodelocal://0/foo/bar' WITH temp = 'path/to/temp'
3-
----
4-
IMPORT TABLE foo FROM PGDUMPCREATE '*****' WITH OPTIONS (temp = 'path/to/temp') -- normalized!
5-
IMPORT TABLE foo FROM PGDUMPCREATE ('*****') WITH OPTIONS (temp = ('path/to/temp')) -- fully parenthesized
6-
IMPORT TABLE foo FROM PGDUMPCREATE '_' WITH OPTIONS (temp = '_') -- literals removed
7-
IMPORT TABLE _ FROM PGDUMPCREATE '*****' WITH OPTIONS (_ = 'path/to/temp') -- identifiers removed
8-
IMPORT TABLE foo FROM PGDUMPCREATE 'nodelocal://0/foo/bar' WITH OPTIONS (temp = 'path/to/temp') -- passwords exposed
9-
10-
parse
11-
IMPORT TABLE foo FROM PGDUMPCREATE ('nodelocal://0/foo/bar') WITH temp = 'path/to/temp'
12-
----
13-
IMPORT TABLE foo FROM PGDUMPCREATE '*****' WITH OPTIONS (temp = 'path/to/temp') -- normalized!
14-
IMPORT TABLE foo FROM PGDUMPCREATE ('*****') WITH OPTIONS (temp = ('path/to/temp')) -- fully parenthesized
15-
IMPORT TABLE foo FROM PGDUMPCREATE '_' WITH OPTIONS (temp = '_') -- literals removed
16-
IMPORT TABLE _ FROM PGDUMPCREATE '*****' WITH OPTIONS (_ = 'path/to/temp') -- identifiers removed
17-
IMPORT TABLE foo FROM PGDUMPCREATE 'nodelocal://0/foo/bar' WITH OPTIONS (temp = 'path/to/temp') -- passwords exposed
18-
191
parse
202
IMPORT INTO foo(id, email) CSV DATA ('path/to/some/file', $1) WITH temp = 'path/to/temp'
213
----
@@ -34,42 +16,6 @@ IMPORT INTO foo CSV DATA ('_', $1) WITH OPTIONS (temp = '_') -- literals removed
3416
IMPORT INTO _ CSV DATA ('*****', $1) WITH OPTIONS (_ = 'path/to/temp') -- identifiers removed
3517
IMPORT INTO foo CSV DATA ('path/to/some/file', $1) WITH OPTIONS (temp = 'path/to/temp') -- passwords exposed
3618

37-
parse
38-
IMPORT PGDUMP 'nodelocal://0/foo/bar' WITH temp = 'path/to/temp'
39-
----
40-
IMPORT PGDUMP '*****' WITH OPTIONS (temp = 'path/to/temp') -- normalized!
41-
IMPORT PGDUMP ('*****') WITH OPTIONS (temp = ('path/to/temp')) -- fully parenthesized
42-
IMPORT PGDUMP '_' WITH OPTIONS (temp = '_') -- literals removed
43-
IMPORT PGDUMP '*****' WITH OPTIONS (_ = 'path/to/temp') -- identifiers removed
44-
IMPORT PGDUMP 'nodelocal://0/foo/bar' WITH OPTIONS (temp = 'path/to/temp') -- passwords exposed
45-
46-
parse
47-
EXPLAIN IMPORT PGDUMP 'nodelocal://0/foo/bar' WITH temp = 'path/to/temp'
48-
----
49-
EXPLAIN IMPORT PGDUMP '*****' WITH OPTIONS (temp = 'path/to/temp') -- normalized!
50-
EXPLAIN IMPORT PGDUMP ('*****') WITH OPTIONS (temp = ('path/to/temp')) -- fully parenthesized
51-
EXPLAIN IMPORT PGDUMP '_' WITH OPTIONS (temp = '_') -- literals removed
52-
EXPLAIN IMPORT PGDUMP '*****' WITH OPTIONS (_ = 'path/to/temp') -- identifiers removed
53-
EXPLAIN IMPORT PGDUMP 'nodelocal://0/foo/bar' WITH OPTIONS (temp = 'path/to/temp') -- passwords exposed
54-
55-
parse
56-
IMPORT PGDUMP ('nodelocal://0/foo/bar') WITH temp = 'path/to/temp'
57-
----
58-
IMPORT PGDUMP '*****' WITH OPTIONS (temp = 'path/to/temp') -- normalized!
59-
IMPORT PGDUMP ('*****') WITH OPTIONS (temp = ('path/to/temp')) -- fully parenthesized
60-
IMPORT PGDUMP '_' WITH OPTIONS (temp = '_') -- literals removed
61-
IMPORT PGDUMP '*****' WITH OPTIONS (_ = 'path/to/temp') -- identifiers removed
62-
IMPORT PGDUMP 'nodelocal://0/foo/bar' WITH OPTIONS (temp = 'path/to/temp') -- passwords exposed
63-
64-
parse
65-
IMPORT PGDUMP ('nodelocal://0/foo/bar') WITH OPTIONS (temp = 'path/to/temp')
66-
----
67-
IMPORT PGDUMP '*****' WITH OPTIONS (temp = 'path/to/temp') -- normalized!
68-
IMPORT PGDUMP ('*****') WITH OPTIONS (temp = ('path/to/temp')) -- fully parenthesized
69-
IMPORT PGDUMP '_' WITH OPTIONS (temp = '_') -- literals removed
70-
IMPORT PGDUMP '*****' WITH OPTIONS (_ = 'path/to/temp') -- identifiers removed
71-
IMPORT PGDUMP 'nodelocal://0/foo/bar' WITH OPTIONS (temp = 'path/to/temp') -- passwords exposed
72-
7319
parse
7420
EXPORT INTO CSV 'a' FROM TABLE a
7521
----

0 commit comments

Comments
 (0)