Closed jamesaoverton closed 3 weeks ago
Thinking about this some more, I would like to reserve the "type" column of the "table" table to tell VALVE about the structure of that table, such as the columns to expect. The current table types do that: table, column, datatype, rule. I've been thinking about adding an 'ldtab' table type, which would also determine which columns that table has.
In contrast, 'view' does not tell VALVE anything about the columns to expect, so 'view' is not a good table type (on this line of reasoning).
Now I think it would be better to have another column of the "table" table for this purpose. Maybe "mode" is a good name for it. This issue is about the 'view' mode. #82 is about the 'generated' mode. We probably want a 'readonly' mode.
Instead of "mode", another idea is an "options" column, with a space-separated list of options, which could include 'view', 'generated', etc.
Here is a small table describing what was decided on 2024-03-05 about view, readonly, and normal tables (we have decided to collapse the distinction between readonly and generated modes since the only thing that distinguishes them is the kind of path each has).
| Mode | Empty | SQL | TSV | Generic executable | Conflict, text views, etc. | Rows are editable | Validation? |
|---------------------------------------------------------|---------------------------------------------------|-----|-----|--------------------|----------------------------|-------------------|-----------------------------------------------|
| Normal | No | No | Yes | No | Yes | Yes | Yes |
| View | Yes | Yes | No | Change to yes | No | No | Not on load, but rows can be validated |
| Readonly (subsumes both the old readonly and generated) | Change to yes (check that it exists, do not drop) | Yes | Yes | Yes | No | No | Currently yes on load. Rows can be validated. |
I want VALVE to support SQL views in the following ways:
*_conflict
table, or*_view
or*_text
viewscreate_all_tables()
will create the view by executing that SQL, and ensure that the view exists afterward or exit with an error c.drop_tables()
anddrop_all_tables()
will drop the viewcreate_all_tables()
will ensure that the view exists afterward or exit with an error b.drop_tables()
anddrop_all_tables()
will skip the viewvalve.sort_tables()
should work for views...validate_row()
, since its columns will be definedfrom(view.column)
, VALVE will not try to enforce a foreign key constraint for T, but VALVE should still supportget_matching_values()
for that column of T -- I think the same should apply forunder()
andtree()
but I'm not sure