SQLite Forum

Possible bug: pragma table_info(A) does not work, but equivalent select does in preupdate hook
Login
We use the preupdate hook to track changes made to the database. In the implementation, in the preupdate hook, we used (via the API):
```
  PRAGMA table_info(tablename)
```
which after a call to step produces the result SQLITE_ROW if the table exists.

We found that in a test script this worked the first time, but not the second. Replacing the PRAGMA statement with the following solved the issue:
```
  SELECT * FROM pragma_table_info(tablename)
```

I have little insight into how or why one works and the other doesn't, or why this happens only the second time. Careful review of the code shows that previous statements are finalized when we get to this part of the code.