CREATE OR REPLACE is a statement to create a table, or replace table if it already exists with single statement.
It worked as expected with in-memory temporary table, however, it didn't work as expected with SQLite Extension (cf. "To Reproduce" section follows).
% duckdb -c "CREATE OR REPLACE TEMPORARY TABLE xs AS SELECT unnest(['foo', 'bar', 'baz']) AS x;" -c "SELECT * FROM xs;"
┌─────────┐
│ x │
│ varchar │
├─────────┤
│ foo │
│ bar │
│ baz │
└─────────┘
To Reproduce
Tried with DuckDB CLI.
% rm -f ./tmp.sqlite
% duckdb -c "ATTACH 'tmp.sqlite' AS tmp (TYPE SQLITE);" -c "USE tmp;" -c "CREATE OR REPLACE TABLE xs AS SELECT unnest(['foo', 'bar', 'baz']) AS x;" -c "SELECT * FROM xs;"
INTERNAL Error: Failed to drop entry "xs" - could not find entry
This error signals an assertion failure within DuckDB. This usually occurs due to unexpected conditions or errors in the program's logic.
For more information, see https://duckdb.org/docs/dev/internal_errors
Catalog Error: Table with name xs does not exist!
Did you mean "system.information_schema.tables"?
LINE 1: SELECT * FROM xs;
^
OS:
macOS 14.5 (23F79)
DuckDB Version:
v1.0.0 1f98600c2c
DuckDB Client:
DuckDB CLI
Full Name:
Yuu Yamashita
Affiliation:
Treasure Data, Inc.
What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.
I have tested with a stable release
Did you include all relevant data sets for reproducing the issue?
Yes
Did you include all code required to reproduce the issue?
[X] Yes, I have
Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?
What happens?
CREATE OR REPLACE is a statement to create a table, or replace table if it already exists with single statement.
It worked as expected with in-memory temporary table, however, it didn't work as expected with SQLite Extension (cf. "To Reproduce" section follows).
To Reproduce
Tried with DuckDB CLI.
OS:
macOS 14.5 (23F79)
DuckDB Version:
v1.0.0 1f98600c2c
DuckDB Client:
DuckDB CLI
Full Name:
Yuu Yamashita
Affiliation:
Treasure Data, Inc.
What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.
I have tested with a stable release
Did you include all relevant data sets for reproducing the issue?
Yes
Did you include all code required to reproduce the issue?
Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?