SQLite Forum

Force SELECT * on a virtual table to return a HIDDEN column
Login
Hello SQLite Forum, I am looking for a way to solve a unique problem. I have several virtual tables that have a common `HIDDEN` column. I would like to return that column with a `SELECT *` if a query uses the column in a predicate.

Imagine:

```
CREATE TABLE file(`path` TEXT, `directory` TEXT, `filename` TEXT, `inode` BIGINT, `file_id` TEXT HIDDEN);
```

And the intended use is:

```
SELECT * FROM file WHERE path = '/home/me/file.txt';
```

You should see the `path`, `directory`, `filename`, `inode` returned.

What I want to do is support also returning `file_id` by default if someone writes a query:

```
SELECT * FROM file WHERE file_id = N;
```

I know the query I proposed could simply be written `SELECT *, file_id ...` but I am aiming for a dont-repeat-yourself experience.

I do not think what I want to achieve is possible, but I wanted to ask if anyone knew of alternatives?