mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Merge pull request #35886 from azat/format-insert-infile-fix
Fix formatting of INSERT INFILE queries (missing quotes)
This commit is contained in:
commit
9d5c13c71d
@ -81,9 +81,17 @@ void ASTInsertQuery::formatImpl(const FormatSettings & settings, FormatState & s
|
||||
|
||||
if (infile)
|
||||
{
|
||||
settings.ostr << (settings.hilite ? hilite_keyword : "") << " FROM INFILE " << (settings.hilite ? hilite_none : "") << infile->as<ASTLiteral &>().value.safeGet<std::string>();
|
||||
settings.ostr
|
||||
<< (settings.hilite ? hilite_keyword : "")
|
||||
<< " FROM INFILE "
|
||||
<< (settings.hilite ? hilite_none : "")
|
||||
<< quoteString(infile->as<ASTLiteral &>().value.safeGet<std::string>());
|
||||
if (compression)
|
||||
settings.ostr << (settings.hilite ? hilite_keyword : "") << " COMPRESSION " << (settings.hilite ? hilite_none : "") << compression->as<ASTLiteral &>().value.safeGet<std::string>();
|
||||
settings.ostr
|
||||
<< (settings.hilite ? hilite_keyword : "")
|
||||
<< " COMPRESSION "
|
||||
<< (settings.hilite ? hilite_none : "")
|
||||
<< quoteString(compression->as<ASTLiteral &>().value.safeGet<std::string>());
|
||||
}
|
||||
|
||||
if (select)
|
||||
|
@ -1,5 +1,5 @@
|
||||
INSERT INTO test FROM INFILE data.file SELECT x
|
||||
INSERT INTO test FROM INFILE \'data.file\' SELECT x
|
||||
FROM input(\'x UInt32\')
|
||||
INSERT INTO test FROM INFILE data.file WITH number AS x
|
||||
INSERT INTO test FROM INFILE \'data.file\' WITH number AS x
|
||||
SELECT number
|
||||
FROM input(\'number UInt32\')
|
||||
|
@ -0,0 +1,3 @@
|
||||
-- { echo }
|
||||
EXPLAIN SYNTAX INSERT INTO foo FROM INFILE '/dev/null' COMPRESSION 'gz';
|
||||
INSERT INTO foo FROM INFILE \'/dev/null\' COMPRESSION \'gz\'
|
@ -0,0 +1,2 @@
|
||||
-- { echo }
|
||||
EXPLAIN SYNTAX INSERT INTO foo FROM INFILE '/dev/null' COMPRESSION 'gz';
|
@ -0,0 +1,3 @@
|
||||
-- { echo }
|
||||
EXPLAIN SYNTAX INSERT INTO foo FROM INFILE '/dev/null';
|
||||
INSERT INTO foo FROM INFILE \'/dev/null\'
|
2
tests/queries/0_stateless/02264_format_insert_infile.sql
Normal file
2
tests/queries/0_stateless/02264_format_insert_infile.sql
Normal file
@ -0,0 +1,2 @@
|
||||
-- { echo }
|
||||
EXPLAIN SYNTAX INSERT INTO foo FROM INFILE '/dev/null';
|
Loading…
Reference in New Issue
Block a user