my database is in Google CloudSQL. and below is my liquibase script that
- creates a simple table
- creates first view based on that table definition
- creates second view based on the first view definition
- and then change the data type of a column in the table
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd"
logicalFilePath="doesntmatter">
<changeSet author="satkon" id="createTable">
<createTable tableName="MYTABLE">
<column name="UUID" type="java.sql.Types.VARCHAR(36)">
<constraints nullable="false" />
</column>
<column name="NAME" type="java.sql.Types.VARCHAR(255)">
<constraints nullable="false" />
</column>
<column name="DESCRIPTION" type="TEXT" />
<column name="SPEC_CONTENT" type="TEXT" />
</createTable>
</changeSet>
<changeSet author="satkon" id="createFirstView">
<createView replaceIfExists="true" viewName="MYVIEW1">
SELECT MYTABLE.UUID AS TABLEID, MYTABLE.SPEC_CONTENT AS SPEC_CONTENT
FROM MYTABLE
</createView>
</changeSet>
<changeSet author="satkon" id="createSecondView">
<createView replaceIfExists="true" viewName="MYVIEW2">
SELECT MYVIEW1.SPEC_CONTENT AS SPEC_CONTENT
FROM MYVIEW1
</createView>
</changeSet>
<changeSet author="satkon" id="updateDataType">
<modifyDataType tableName="MYTABLE"
columnName="SPEC_CONTENT" newDataType="MEDIUMTEXT" />
</changeSet>
</databaseChangeLog>
by the end of this script execution, the definition of MYVIEW2 is becoming invalid and throws “eferences invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them” error. This is happening only on CloudSQL database. If I generate the SQL statements from liquibase using “updateSQL” option and execute those SQLs manually, then issue does not occur.
If liquibase is not involved there does not seem to be any issue. Can someone please help on this issue?