Liquibase precondition sql check returns incorrect result

788 views Asked by At

I've been struggling to troubleshoot and fix this problem for few days now. The liquibase changeset are not running due to sql check.

-- changeset ryanjan:1 context:staging
-- preconditions onFail:MARK_RAN onError:MARK_RAN
-- precondition-sql-check expectedResult:1 SELECT COUNT(column_name) FROM information_schema.columns WHERE table_name='position' and column_name='initial';
ALTER TABLE public.position
  RENAME COLUMN initial TO shortname;

-- changeset ryanjan:2 context:staging
CREATE INDEX IF NOT EXISTS position_shortname_unique ON public.position (shortname);

The first changeset is not executing for unknown reason.

Troubleshooting performed

  1. I logged in to the staging DB cli and connected to the same user.
  2. Executed the same SELECT query and got result 1.
  3. Reviewed the public.position table and column initial exists.

At this moment, I can no longer think of what's wrong with the query. I am able to perform the query via CLI with the same account so permission grant is not a problem (I think). Removing the precondition-sql-check will surely execute the changeset.

PostgreSQL version 13.1

0

There are 0 answers