Skip to content
TheChatArchiveThe Chat Archive
gpt-5.6-sol· openaiHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

alter col leaves sqlitesequence table behind note that i'm unsure of alter column rules,…

  1. User

    alter col leaves sqlite_sequence table behind note that i'm unsure of alter column rules, i was not able to find any docs or rules around this, but my expectation is when we change a autoincrement col to plain text there shouldn't be a stale sqlite_sequence.

    turso> CREATE TABLE t(a INTEGER PRIMARY KEY AUTOINCREMENT, b TEXT);
      INSERT INTO t(b) VALUES('x'),('y');
    
      ALTER TABLE t ALTER COLUMN a TO a2 TEXT;
    
      SELECT * FROM sqlite_sequence;
      SELECT sql FROM sqlite_schema WHERE name='t';
    ┌──────┬─────┐
    │ name │ seq │
    ├──────┼─────┤
    │ t    │   2 │
    └──────┴─────┘
    ┌──────────────────────────────────┐
    │ sql                              │
    ├──────────────────────────────────┤
    │ CREATE TABLE t (a2 TEXT, b TEXT) │
    └──────────────────────────────────┘
    turso> select * from sqlite_schema;
    ┌───────┬─────────────────┬─────────────────┬──────────┬────────────────────────────────────────┐
    │ type  │ name            │ tbl_name        │ rootpage │ sql                                    │
    ├───────┼─────────────────┼─────────────────┼──────────┼────────────────────────────────────────┤
    │ table │ sqlite_sequence │ sqlite_sequence │        2 │ CREATE TABLE sqlite_sequence(name,seq) │
    ├───────┼─────────────────┼─────────────────┼──────────┼────────────────────────────────────────┤
    │ table │ t               │ t               │        3 │ CREATE TABLE t (a2 TEXT, b TEXT)       │
    └───────┴─────────────────┴─────────────────┴──────────┴────────────────────────────────────────┘
    

    Interface

    No new interfaces are introduced.

  2. Assistant

    I’m going to trace the ALTER COLUMN rebuild path and its schema/sequence cleanup. I’ll use the code-quality and testing guides because this is an implementation fix that needs a regression test.

  3. Assistant

    rg isn’t installed in this checkout, so I’m falling back to targeted grep searches. I’m first locating the schema rewrite and existing ALTER tests, then I’ll add the smallest compatibility case that captures the stale row.

  4. Assistant

    The stale row is emitted because ALTER rewrites sqlite_schema but never performs the sequence cleanup that DROP TABLE already does. The affected case is specifically altering the AUTOINCREMENT rowid-alias column; altering some other column must preserve the counter. I’m adding coverage for both sides of that distinction.

  5. Assistant

    The regression test fails on the pre-fix build exactly as reported (count(*) is 1), while the control case confirms changing a different column retains t|2. The fix now deletes only the affected table’s sequence row and updates the in-memory table metadata so later statements in the same connection no longer treat it as AUTOINCREMENT.

  6. Assistant

    The repository isn’t clean under the installed formatter: formatting the touched files rewrote unrelated import ordering and expressions. I’m removing those mechanical changes and retaining only the targeted implementation/test diff before final verification.

  7. Assistant

    The focused ALTER COLUMN suite now passes all 59 cases, including a same-connection insert proving the altered text column receives NULL rather than continuing AUTOINCREMENT behavior. A broader turso_core test attempt with --no-default-features is not a supported configuration here and failed on pre-existing feature-gated APIs (uuid, UnixIO::new, database open helpers); the default-feature build used by the SQL suite succeeds.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.