In this example, you will get a database error somewhat like the following:
"type": "DatabaseError",
"message": "missing FROM-clause entry for table \"baz\"",
This is because foo's parent table is set first to bar, but then overridden with baz.
A solution to this is to make the parentTable property on SQLExpressionreadonly, and to require making a copy of the SQLExpression to set the parentTable.
Let me know if you want me to make a minimal reproduce-able example!
Here is an example of a query with the problem:
In this example, you will get a database error somewhat like the following:
This is because
foo
's parent table is set first tobar
, but then overridden withbaz
.A solution to this is to make the
parentTable
property onSQLExpression
readonly
, and to require making a copy of theSQLExpression
to set theparentTable
.