You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
first_view = PGView(
schema="public",
signature="first_view",
definition="select 'Test' as "Foo" from information_schema.tables",
)
Create migration and run
Modify my_view.py:
first_view = PGView(
schema="public",
signature="first_view",
definition="select 1 as "Bar", 'Test' as "Foo" from information_schema.tables",
)
Create migration and run
Actual
Error
cannot change name of view column "Foo" to "Bar"
[SQL: CREATE OR REPLACE VIEW "public"
Expected
Success
Suggestion
It looks like this is caused by using SQL command CREATE OR REPLACE VIEW, which is known to only support appending columns, not inserting or re-ordering
CREATE OR REPLACE VIEW is similar, but if a view of the same name already exists, it is replaced. The new query must generate the same columns that were generated by the existing view query (that is, the same column names in the same order and with the same data types), but it may add additional columns to the end of the list. The calculations giving rise to the output columns may be completely different.
Reproducible
my_view.py
:my_view.py
:Actual
Error
Expected
Success
Suggestion
It looks like this is caused by using SQL command
CREATE OR REPLACE VIEW
, which is known to only support appending columns, not inserting or re-orderinghttps://www.postgresql.org/docs/9.3/sql-createview.html
As such, it seems as though the view should be dropped and recreated
The text was updated successfully, but these errors were encountered: