This project is archived and is in readonly mode.

#1603 ✓invalid
Paul Hinze

sqlite3 adapter should not raise exception when table does not exist

Reported by Paul Hinze | December 19th, 2008 @ 04:21 PM | in 2.x

The other connection adapters I've seen allow columns to return null, but in SQLite3Adapter#table_structure an exception is raised.n This prevents any descendants from ActiveRecord::Base from being initialized without a table existing.

Here is where the exception is raised:

For reference, note the MySQL adapter allows columns to return an empty array:

If there's a good reason for this design decision, then I'm happy to hear it, but right now it's preventing me from running unit tests that create temporary models (tests that pass on a SQL Server adapter) on SQLite.

Noting Jeremy just because github has him as the last one to touch the file.

Comments and changes to this ticket

  • Pratik

    Pratik March 13th, 2009 @ 02:23 PM

    • State changed from “new” to “invalid”
    • Assigned user changed from “Jeremy Kemper” to “Pratik”

    The table_structure() method is just an internal method used by connection#columns(). connection#columns() raises an exception in MySQL when the table is missing.

    I think it's a good design to fail early in such cases rather than silently ignoring failures.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket