Vex · Errors

Unknown table

compile throws a VexError with code invalid_dsl when from names a table that is not in the schema. Table names are validated against the schema before any SQL is compiled. The error’s details contain suggestion, the closest table name in the schema, and options, every table name.

Query
{ from: ['booking'], fields: ['booking.seats'] }
Tables
CREATE TABLE bookings (
  id text PRIMARY KEY,
  show_night text NOT NULL REFERENCES shows(night),
  member_id text NOT NULL REFERENCES members(id),
  seats integer NOT NULL
)
CREATE TABLE members (id text PRIMARY KEY, name text NOT NULL)
CREATE TABLE shows (night text PRIMARY KEY, title text NOT NULL)
Error
invalid_dsl
Entity "booking" not found in schema. Did you mean "bookings"?
Error details
{
  suggestion: 'bookings',
  options: ['bookings', 'members', 'shows'],
}
Output matches the expected value

Runs in this page on the installed package. The input and the expected output are defined by the example.