小编ncl*_*clu的帖子

运行Liquibase时出现Null/Out of Bounds错误

我正在使用数据库迁移Grails插件.但是当使用liquibase格式化的sql迁移时,运行dbm-update会导致我的某些sql出现致命错误.我收到此错误:

liquibase : 'Change Set GraphFunctions.sql::graph_functions_initialize_1::<user> failed.  Error: null'
java.lang.ArrayIndexOutOfBoundsException
Run Code Online (Sandbox Code Playgroud)

当我运行代码时会发生这种情况:

--changeset <username>:graph_functions_initialize_1
CREATE OR REPLACE FUNCTION build_trcd(
    IN new_parent_id bigint,
    IN new_child_id bigint)
    RETURNS TABLE(ancestor_id bigint, descendant_id bigint, paths bigint, cost bigint) AS '
    SELECT
        t1.ancestor_id AS ancestor_id,
        t2.descendant_id AS descendant_id,
        SUM(t1.paths*t2.paths)::bigint AS paths,
        MIN(t1."cost"+t2."cost")+1::bigint AS "cost"
    FROM db_set_membership_closure t1, db_set_membership_closure t2
    WHERE t1.descendant_id=new_parent_id AND t2.ancestor_id=NEW_child_id
    GROUP BY t1.ancestor_id, t2.descendant_id
    UNION
    SELECT
        NEW_parent_id AS ancestor_id,
        descendant_id AS descendant_id,
        paths AS paths ,
        (c."cost" + 1)::bigint AS "cost"
    FROM db_set_membership_closure …
Run Code Online (Sandbox Code Playgroud)

grails liquibase

1
推荐指数
1
解决办法
610
查看次数

标签 统计

grails ×1

liquibase ×1