Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"CREATE OR REPLACE TABLE" failed with SQLite3 table if given table doesn't exist #104

Closed
2 tasks done
yyuu opened this issue Jul 18, 2024 · 1 comment · Fixed by #112
Closed
2 tasks done

"CREATE OR REPLACE TABLE" failed with SQLite3 table if given table doesn't exist #104

yyuu opened this issue Jul 18, 2024 · 1 comment · Fixed by #112

Comments

@yyuu
Copy link

yyuu commented Jul 18, 2024

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).

% 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?

  • Yes, I have

Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?

  • Yes, I have
@hannes hannes transferred this issue from duckdb/duckdb Jul 19, 2024
@hannes
Copy link
Member

hannes commented Jul 19, 2024

Thanks for filing this, transferred to here because its related to the sqlite scanner.

Mytherin added a commit that referenced this issue Sep 4, 2024
Fix #104: make CREATE OR REPLACE TABLE work in SQLite catalog instead of throwing an exception
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants