Hello,
i am testing liquibase for the 1st time (i often use flyway, but i just wanted to test liquibase).
First script:
myfile.sql
--liquibase formatted sql
--changeset bob:1
CREATE OR REPLACE FUNCTION week_to_date(
IN in_year INTEGER,
IN in_week INTEGER,
IN in_dow INTEGER DEFAULT NULL
)
RETURNS DATE AS
$$
BEGIN
RETURN to_timestamp('1 ' || in_year, 'IW IYYY')::DATE + (COALESCE(in_dow, 1) + 6) % 7 + 7 * in_week - 7;
END;
$$ LANGUAGE plpgsql;
my cmd:
liquibase --driver=org.postgresql.Driver --classpath=postgresql-42.2.2.jar --url="jdbc:postgresql://localhost:60901/mydb" --username=myusey --password=mypwd --schemas=myschema --changeLogFile=myfile.sql migrate
result:
Unexpected error running Liquibase: Unterminated dollar quote started at position 137 in SQL CREATE OR REPLACE FUNCTION week_to_date(
IN in_year INTEGER,
IN in_week INTEGER,
IN in_dow INTEGER DEFAULT NULL
)
RETURNS DATE AS
$$
BEGIN
RETURN to_timestamp('1 ' || in_year, 'IW IYYY')::DATE + (COALESCE(in_dow, 1) + 6) % 7 + 7 * in_week - 7
END. Expected terminating $$ [Failed SQL: (0) CREATE OR REPLACE FUNCTION week_to_date(
IN in_year INTEGER,
IN in_week INTEGER,
IN in_dow INTEGER DEFAULT NULL
)
RETURNS DATE AS
$$
BEGIN
RETURN to_timestamp('1 ' || in_year, 'IW IYYY')::DATE + (COALESCE(in_dow, 1) + 6) % 7 + 7 * in_week - 7
END]
For more information, please use the --logLevel flag
i’ve been searching for about 45 mins
Did not find any solutions…
if someone have found…
thx