SQLite Forum

Possible bug: pragma table_info(A) does not work, but equivalent select does in preupdate hook
Login
Thank you for the follow up!

It is during pre-update - INSERT.

This is the sequence of commands that produce the result, starting with an empty db file (the content is arbitrary and part of a test script):

```
CREATE TABLE dogs (tag INTEGER PRIMARY KEY, name VARCHAR, age INT, height REAL);
INSERT INTO dogs (name, age, height) VALUES ("Scooby", 8, 0.8);
INSERT INTO dogs (name, age, height) VALUES ("Scrappy", 6, 0.4);

CREATE TABLE people (rowid INTEGER PRIMARY KEY, name VARCHAR, age INT, height REAL);
```
The described failure occurs on the second CREATE TABLE, performing `PRAGMA tableinfo(people)` in the preupdate hook. For the first CREATE it works fine. 

We open separate db handles for the client side (submitting the test script commands) and running the PRAGMA table_info; the preupdate hook is installed on the client handle.

After the error and in my debugging I carefully went over all statements and made sure everything was finalized properly. The command completes normally. This is supported by the fact that replacing the sequence `PRAGMA tableinfo...` with `SELECT * FROM pragma_table_info...` it does work as expected.

I did some refactoring yesterday and will try again with the PRAGMA version to see if something has changed.