首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >液基中的Postgres下降函数显示错误

液基中的Postgres下降函数显示错误
EN

Stack Overflow用户
提问于 2017-10-13 11:52:08
回答 1查看 1.8K关注 0票数 2

xml文件中有FUNCTION,如下所示:

代码语言:javascript
复制
<?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"
        xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
        xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd
        http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">

    <changeSet id="1.0-procedures" author="api-manager">

        <sql>
            DROP FUNCTION IF EXISTS proc_api_consumer_audit_insert;
        </sql>

        <createProcedure>
            CREATE FUNCTION proc_api_consumer_audit_insert()
            RETURNS TRIGGER AS $api_consumer_audit$
            BEGIN
                INSERT INTO api_consumer_audit(LOREM_IPSUM) VALUES(LOREM_IPSUM);
                RETURN NEW;
            END;
            $$ LANGUAGE plpgsql;
        </createProcedure>

        <rollback>
            DROP FUNCTION IF EXISTS proc_api_consumer_audit_insert;
        </rollback>
    </changeSet>
</databaseChangeLog>

更新期间的清算库显示了下面的错误:

代码语言:javascript
复制
[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.5.3:update (default-cli) on project api-manager: Error setting up or running Liquibase: Migration failed for change set db/dev/changelog/1.0/1.0-procedures.xml::1.0-procedures::api-manager:
[ERROR] Reason: liquibase.exception.DatabaseException: ERROR: syntax error at end of input
[ERROR] Pozycja: 55 [Failed SQL: DROP FUNCTION IF EXISTS proc_api_consumer_audit_insert]
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Process finished with exit code 1

我无法解决此错误日志。我该怎么修理这个?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-10-13 11:55:01

若要删除函数,需要指定包含参数签名的函数。如果函数没有参数,则需要使用()

代码语言:javascript
复制
DROP FUNCTION IF EXISTS proc_api_consumer_audit_insert();

这在Postgres 10中已经被放宽了。如果函数没有重载(所以正好有一个参数签名),您可以省略参数列表。因此,在Postgres 10中,您的声明将在没有更改的情况下工作。

票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46729316

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档