liquibase-redshift icon indicating copy to clipboard operation
liquibase-redshift copied to clipboard

Error getting current schema

Open crony1 opened this issue 8 years ago • 16 comments

The plugin is issuing 'select current_user' to Redshift and erroring with the following:

Unexpected error running Liquibase: Error executing SQL select current_schema: [Amazon](500310) Invalid operation: column "current_schema" does not exist; Issuing the command directly to Redshift returns the same error. I believe the correct statement should be 'select current_schema()' according to Amazon documentation

EDIT: I should add that I was using the JDBC driver provided by Amazon.

┆Issue is synchronized with this Jira Bug by Unito

crony1 avatar May 13 '16 19:05 crony1

@crony1 Did you resolve this?

haavardeide avatar Jul 08 '16 08:07 haavardeide

Hi, I am facing the same issue with liquibase 3.5.1. With liquibase 3.3.2 I can see the following : Error setting up or running Liquibase: java.sql.SQLException: [Amazon](500310) Invalid operation: syntax error at or near "TAG";

ValentinOzanne avatar Jul 08 '16 16:07 ValentinOzanne

@haavardeide I never did resolve this unfortunately.

crony1 avatar Jul 09 '16 11:07 crony1

I just ran across this by chance while searching for a related Redshift error.

The current_schema error can be resolved by changing select current_schema to select current_schema(). Redshift thinks it is a column name otherwise.

trevorsmith avatar Jul 11 '16 22:07 trevorsmith

we faced the same issue: "Amazon Invalid operation: column "current_schema" does not exist;" Any updates?

2un avatar Jul 19 '16 10:07 2un

Hi You can have a look at my fork : https://github.com/ValentinOzanne/liquibase-redshift

I committed a workaround to use "public" schema instead of launching an unsupported query. I quickly tried to use "select current_schema()" request but it didn't work and I didn't work again on this issue.

Hope it helps

ValentinOzanne avatar Jul 19 '16 15:07 ValentinOzanne

@ValentinOzanne That fork did the trick for me! Thanks!

haavardeide avatar Aug 22 '16 12:08 haavardeide

Please merge your fix back into the main project so we can eventually get this version from the maven-repo.

jimsunrun avatar Oct 07 '16 01:10 jimsunrun

Btw, the Error setting up or running Liquibase: java.sql.SQLException: Amazon Invalid operation: syntax error at or near "TAG";

is caused during the creation of databasechangelog. This is because you use a mysql script for redshift. Tag is not a reserved word in mysql, but it is a reserved word in Redshift

Engineer1111 avatar Nov 20 '17 23:11 Engineer1111

Did anyone work around the TAG issue @Engineer1111 highlighted? Does that mean liquibase isn't usable for Redshift at the moment?

fixl avatar Jul 11 '18 02:07 fixl

I am trying to use Liquibase for redshift migration and ran into the same issue @Engineer1111 highlighted. Please help on the workaround. Can I go ahead and use it for redshift?

TamilVP avatar Aug 02 '18 06:08 TamilVP

Using 1.0-SNAPSHOT it is working

radoslawjakubowski avatar Feb 28 '19 13:02 radoslawjakubowski

@nvoxland, Could you please deploy/publish artifacts version 1.1, containing latest changes?

Thanks a lot!

romankoval avatar Jun 18 '19 13:06 romankoval

I've built latest 1.1-SNAPSHOT and put into local repo, but the issue with TAG isn't fixed yet.

As well weird things may happened after few restarts all tables are recreated. WHY?

romankoval avatar Jun 20 '19 17:06 romankoval

Created PR for TAG issue. As a workaround you can create your own RedshiftDatabase class:

package liquibase.ext.redshiftfix.database; // Class has to be located in this package

import liquibase.ext.redshift.database.RedshiftDatabase;

public class RedshiftDatabaseFix extends RedshiftDatabase {

    private static final int HIGH_PRIORITY = 5;

    @Override
    public int getPriority() {
        return HIGH_PRIORITY;
    }

    @Override
    public String getShortName() {
        return "redshiftFix";
    }

    @Override
    protected String getDefaultDatabaseProductName() {
        return "RedshiftFix";
    }
}

balbusm avatar Mar 10 '20 10:03 balbusm

Can we have this resolved please?

thegeekyasian avatar Mar 18 '20 11:03 thegeekyasian