Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: cannot drop columns from view from marquez/db/migration/R__3_Datasets_view.sql #2183

Closed
Esaych opened this issue Oct 12, 2022 · 4 comments · Fixed by #2184
Closed
Labels
bug Something isn't working

Comments

@Esaych
Copy link
Contributor

Esaych commented Oct 12, 2022

Issue

With existing local database instance, starting up my lineage backend service throws this error. Work around for me is to delete my database and recreate it. Ideally this shouldn't need to happen.

! org.postgresql.util.PSQLException: ERROR: cannot drop columns from view
! at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2676)
! at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2366)
! at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:356)
! at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:496)
! at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:413)
! at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:333)
! at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:319)
! at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:295)
! at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:290)
! at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
! at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
! at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
! at java.base/java.lang.reflect.Method.invoke(Method.java:568)
! at org.apache.tomcat.jdbc.pool.StatementFacade$StatementProxy.invoke(StatementFacade.java:118)
! at jdk.proxy2/jdk.proxy2.$Proxy46.execute(Unknown Source)
! at org.flywaydb.core.internal.jdbc.JdbcTemplate.executeStatement(JdbcTemplate.java:201)
! at org.flywaydb.core.internal.sqlscript.ParsedSqlStatement.execute(ParsedSqlStatement.java:95)
! at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.executeStatement(DefaultSqlScriptExecutor.java:210)
! ... 28 common frames omitted
! Causing: org.flywaydb.core.internal.sqlscript.FlywaySqlScriptException: Migration R__3_Datasets_view.sql failed
! ---------------------------------------
! SQL State  : 42P16
! Error Code : 0
! Message    : ERROR: cannot drop columns from view
! Location   : marquez/db/migration/R__3_Datasets_view.sql (/usr/src/app/file:/usr/src/app/datakin-api.jar!/marquez/db/migration/R__3_Datasets_view.sql)
! Line       : 1
! Statement  : CREATE OR REPLACE VIEW datasets_view
! AS
! SELECT uuid,
!        type,
!        created_at,
!        updated_at,
!        namespace_uuid,
!        source_uuid,
!        name,
!        physical_name,
!        description,
!        current_version_uuid,
!        last_modified_at,
!        namespace_name,
!        source_name,
!        is_deleted
! FROM datasets
! WHERE is_hidden IS FALSE
! 
! at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.handleException(DefaultSqlScriptExecutor.java:275)
! at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.executeStatement(DefaultSqlScriptExecutor.java:222)
! at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.execute(DefaultSqlScriptExecutor.java:126)
! at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.executeOnce(SqlMigrationExecutor.java:69)
! at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.lambda$execute$0(SqlMigrationExecutor.java:58)
! at org.flywaydb.core.internal.database.DefaultExecutionStrategy.execute(DefaultExecutionStrategy.java:27)
! at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.execute(SqlMigrationExecutor.java:57)
! at org.flywaydb.core.internal.command.DbMigrate.doMigrateGroup(DbMigrate.java:377)
! ... 22 common frames omitted

How to reproduce

Run migration with existing database instance

Expected behaviour

No errors should be thrown and backend should start without problem

@boring-cyborg
Copy link

boring-cyborg bot commented Oct 12, 2022

Thanks for opening your first issue in the Marquez project! Please be sure to follow the issue template!

@pawel-big-lebowski
Copy link
Collaborator

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.

@collado-mike
Copy link
Collaborator

collado-mike commented Oct 13, 2022 via email

@pawel-big-lebowski pawel-big-lebowski added the bug Something isn't working label Oct 13, 2022
@pawel-big-lebowski
Copy link
Collaborator

Fortunately, this affects only people who do have previous version installed and are now upgrading from main branch. So it does not affect any released versions of Marquez.

It's great, you were able to spot it, @Esaych 👍
Dropping view before should be the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants