[ADAP-939] [Bug] cannot reference permanent table from temporary table constraint
when running incremental model with a foreign key
#644
Labels
Most of the content below is copy-pasted from @amardatar within dbt-labs/dbt-core#8022
Is this a new bug in dbt-redshift?
Current Behavior
When running an incremental model with contract enforced and a foreign key, the model will fail on subsequent updates.
Expected Behavior
The update should succeed without an error.
Steps To Reproduce
First run a statement like:
Then, given a
schema.yml
file:And a SQL file:
dbt will succeed on the first run, and subsequently fail with the error:
As per the error returned, the issue appears to be that while rendering a temporary table as part of the update, dbt will also render the foreign key constraint (which is not valid in the context of a temporary table). This leads to the above failure.
Relevant log output
No response
Environment
The text was updated successfully, but these errors were encountered: