The stored procedure SOURCE_CHANGES detects the differences between
the schema of a base view and its underlying data source.

For example, for a JDBC base view it detects the differences between the
schema of the table in the database and the schema of the base view.

Syntax

SOURCE_CHANGES (
table_name : text
)

table_name: name of the base view. If the view does not exist
or is not a derived view, the procedure returns an error.

The procedure returns a row for each field of the view and also a row
for each field that is present in the source, but not in the base view.

If a field is an array or a register, there will also be a row for each
one of its subfields.

The output schema of this procedure has the following fields:

field: name of the field in the view. If the row represents a new
field, it is the name of the field in the source.

type: new type of the field. If the field has not changed, this
value is the same as “old_type”. If the field has been removed from the
source, this value is empty.

old_type: old type of the field. If the type of the field has not
changed, this value is the same as “type”. If the row represents a new
field, this value is empty.

modification: If it is empty, the field has not changed. Otherwise,
it has one of these values:

“New field”: when the row represents a field that has been added to
the source.

“Deleted field”: when the row represents a field that has been
deleted from the source.

“Type has changed”: the type of the field has changed.

“Compound structure has changed”: one of the subfields of this field
has changed.

level: For first-level fields, the value is 1.

Remarks

By default, this procedure returns an error if it does not find the source. For example, it returns an error if table_name is a JDBC base view and the table/view was deleted from the database, if table_name is a JSON base view and the JSON file does not exist, etc.

If you do not want the procedure to fail when the source does not exist, execute the following statement from the VQL Shell (you need to be an administrator):