crystal-sqlite3 icon indicating copy to clipboard operation
crystal-sqlite3 copied to clipboard

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

Open vectorselector opened this issue 2 years ago • 0 comments
trafficstars

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?

vectorselector avatar Apr 05 '23 17:04 vectorselector