Skip to content

DROP TABLE IF EXISTS issue. Exception: no such table: tablename (SQLite3::Exception) #88

@vectorselector

Description

@vectorselector

DB.open "sqlite3:./mydb.sqlite3" do |db|
db.exec "DROP TABLE IF EXISTS tablename"
end

triggers "Exception: no such table: tablename (SQLite3::Exception)"

when:

sqlite3 mydb.sqlite3
SQLite version 3.31.1 2020-01-27 19:55:54
Enter ".help" for usage hints.
sqlite> .tables
tablename

  1. table exists
  2. sqlite3 implements "DROP TABLE IF EXISTS tablename" which should NOT trigger any exception.
  3. crystal-sqlite3 test spec https://github.com/crystal-lang/crystal-sqlite3/blob/master/spec/db_spec.cr
    specifically invokes (lines 81-83)

drop_table_if_exists_syntax do |table_name|
"drop table if exists #{table_name}"
end

  1. I cleaned cache ~/.cache/crystal/

crystal version 1.7.3

What am I doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions