mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-18 21:51:57 +00:00
Fixed inserting into Buffer engine
by not throwing exception from DatabaseCatalog::tryGetTable() when database name is empty
This commit is contained in:
parent
52a26a6653
commit
5ec63c782c
@ -344,7 +344,8 @@ DatabaseAndTable DatabaseCatalog::getTableImpl(
|
|||||||
DatabasePtr database;
|
DatabasePtr database;
|
||||||
{
|
{
|
||||||
std::lock_guard lock{databases_mutex};
|
std::lock_guard lock{databases_mutex};
|
||||||
auto it = databases.find(table_id.getDatabaseName());
|
// hasDatabase() to avod getDatabaseName() throwing exception if database is empty.
|
||||||
|
auto it = table_id.hasDatabase() ? databases.find(table_id.getDatabaseName()) : databases.end();
|
||||||
if (databases.end() == it)
|
if (databases.end() == it)
|
||||||
{
|
{
|
||||||
if (exception)
|
if (exception)
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
-- Based on https://github.com/ClickHouse/ClickHouse/issues/52436
|
||||||
|
-- Test that inserts performed via Buffer table engine land into destination table.
|
||||||
|
-- { echoOn }
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS null_table;
|
||||||
|
DROP TABLE IF EXISTS null_table_buffer;
|
||||||
|
DROP TABLE IF EXISTS null_mv;
|
||||||
|
DROP VIEW IF EXISTS number_view;
|
||||||
|
CREATE TABLE null_table (number UInt64) ENGINE = Null;
|
||||||
|
CREATE VIEW number_view as SELECT * FROM numbers(10) as tb;
|
||||||
|
CREATE MATERIALIZED VIEW null_mv Engine = Log AS SELECT * FROM null_table LEFT JOIN number_view as tb USING number;
|
||||||
|
CREATE TABLE null_table_buffer (number UInt64) ENGINE = Buffer(currentDatabase(), null_table, 1, 1, 1, 100, 200, 10000, 20000);
|
||||||
|
INSERT INTO null_table_buffer VALUES (1);
|
||||||
|
SELECT sleep(3) FORMAT Null;
|
||||||
|
-- Insert about should've landed into `null_mv`
|
||||||
|
SELECT count() FROM null_mv;
|
||||||
|
1
|
@ -0,0 +1,19 @@
|
|||||||
|
-- Based on https://github.com/ClickHouse/ClickHouse/issues/52436
|
||||||
|
-- Test that inserts performed via Buffer table engine land into destination table.
|
||||||
|
-- { echoOn }
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS null_table;
|
||||||
|
DROP TABLE IF EXISTS null_table_buffer;
|
||||||
|
DROP TABLE IF EXISTS null_mv;
|
||||||
|
DROP VIEW IF EXISTS number_view;
|
||||||
|
|
||||||
|
CREATE TABLE null_table (number UInt64) ENGINE = Null;
|
||||||
|
CREATE VIEW number_view as SELECT * FROM numbers(10) as tb;
|
||||||
|
CREATE MATERIALIZED VIEW null_mv Engine = Log AS SELECT * FROM null_table LEFT JOIN number_view as tb USING number;
|
||||||
|
|
||||||
|
CREATE TABLE null_table_buffer (number UInt64) ENGINE = Buffer(currentDatabase(), null_table, 1, 1, 1, 100, 200, 10000, 20000);
|
||||||
|
INSERT INTO null_table_buffer VALUES (1);
|
||||||
|
SELECT sleep(3) FORMAT Null;
|
||||||
|
|
||||||
|
-- Insert about should've landed into `null_mv`
|
||||||
|
SELECT count() FROM null_mv;
|
Loading…
Reference in New Issue
Block a user