title: Cursor returns the same columns after "Query, Drop Table, Create Table, Query for the same table name"
body: <p>For example I have a table named <code>myTable</code> in my database file (Android, p.s. it doesn't support column renaming, deleting and so on).</p>
  
  <p>This table has <code>idx</code>, <code>name</code> columns</p>
  
  <p>I want to delete and recreate this table but with new columns</p>
  
  <p>Here how I do it:</p>
  
  <pre><code>db.transaction {
      var cursor = query("myTable", null, null, null, null, null, null)
      // save info to a list and insert it later to a recreated table with new columns
      cursor.close()
  
      // delete table "myTable"
      execSQL("DROP TABLE IF EXISTS myTable")
  
      // create table "myTable" but with new columns
      execSQL("CREATE TABLE myTable(id, title)")
  
      // get columns
      cursor = query("myTable", null, null, null, null, null, null)
      val columnNames = cursor.columnNames
      cursor.close()
      Log.i(TAG, "columns of new table ${Arrays.toString(columnNames)}")
  }
  </code></pre>
  
  <p>But <code>cursor.columnNames</code> doesn't return new columns (<code>id</code>, <code>title</code>)</p>
  
  <p>It returns the old columns (e.g., <code>idx</code>, <code>name</code>)</p>
  
  <p>Though when I close the app and open again everything is ok (old columns are gone and new ones are available)</p>
  
  <p>So annoying!</p>
  
  <p>So new columns are created ok in <code>main.db/myTable</code> during all this process but seems the app still keeps old columns in memory</p>
  
  <p>I can't even use <code>cursor.getString(cursor.getColumnIndex("title"))</code> (would return <code>-1</code>) because it still thinks that this column doesn't exist yet until I restart this app</p>
  
  <p>BUT! Recreating a table with new columns works fine if I don't use <code>cursor</code> to backup data (info) before I delete the old table</p>
  
  <pre><code>db.transaction {
      // !! I COMMENTED THESE LINES
      // var cursor = query("myTable", null, null, null, null, null, null)
      // save info to a list and insert it later to a recreated table with new columns
      // cursor.close()
  
      // delete table "myTable"
      execSQL("DROP TABLE IF EXISTS myTable")
  
      // create table "myTable" but with new columns
      execSQL("CREATE TABLE myTable(id, title)")
  
      // get columns
      cursor = query("myTable", null, null, null, null, null, null)
      val columnNames = cursor.columnNames
      cursor.close()
      Log.i(TAG, "columns of new table ${Arrays.toString(columnNames)}")
  }
  </code></pre>
  
  <p>In this case <code>cursor.columnNames</code> returns new columns <code>id</code>, <code>title</code></p>
  
  <p>This is crazy!</p>
  
  <p>So it seems <code>query table1</code>, <code>drop table1</code>, <code>create table1</code>, <code>query table1</code> sequence would lead to an unexpected behavior</p>
  
  <p>And we can only do <code>drop table1</code>, <code>create table1</code>, <code>query table1</code> sequence </p>