mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Fix
This commit is contained in:
parent
9bbbbdcdd6
commit
a69905d378
@ -313,17 +313,17 @@ void LocalServer::cleanup()
|
||||
}
|
||||
|
||||
|
||||
static bool checkIfStdinIsNotEmpty()
|
||||
static bool checkIfStdinIsRegularFile()
|
||||
{
|
||||
struct stat file_stat;
|
||||
return fstat(STDIN_FILENO, &file_stat) == 0 && (S_ISREG(file_stat.st_mode) || S_ISFIFO(file_stat.st_mode));
|
||||
return fstat(STDIN_FILENO, &file_stat) == 0 && S_ISREG(file_stat.st_mode);
|
||||
}
|
||||
|
||||
std::string LocalServer::getInitialCreateTableQuery()
|
||||
{
|
||||
/// We can create initial table only when we have data for it
|
||||
/// in file or in stdin (we treat stdin as table data if we have query)
|
||||
if (!config().has("table-file") && (!checkIfStdinIsNotEmpty() || !config().has("query")))
|
||||
if (!config().has("table-file") && (!checkIfStdinIsRegularFile() || !config().has("query")))
|
||||
return {};
|
||||
|
||||
auto table_name = backQuoteIfNeed(config().getString("table-name", "table"));
|
||||
|
@ -12,6 +12,6 @@ $CLICKHOUSE_LOCAL -q "select * from table" < data.jsoneachrow
|
||||
|
||||
rm data.jsoneachrow
|
||||
|
||||
echo -e "1\t2\t3" | $CLICKHOUSE_LOCAL -q "desc table table"
|
||||
echo -e "1\t2\t3" | $CLICKHOUSE_LOCAL -q "select * from table"
|
||||
echo -e "1\t2\t3" | $CLICKHOUSE_LOCAL -q "desc table table" --file=-
|
||||
echo -e "1\t2\t3" | $CLICKHOUSE_LOCAL -q "select * from table" --file=-
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user