2012-06-29 66 views
1

我們使用Ant在我們的測試環境中創建一個數據庫具有以下任務螞蟻,執行-SQL腳本和錯誤的PostgreSQL

<execute-sql-script 
    driver=org.postgresql.Driver 
    url=jdbc:postgresql://127.0.0.1:5432/lakshmi_testapp?searchpath=lakshmi_stdcmp 
    user=lakshmi_stdcmp 
    password=******** 
    classpathid=execute-sql.classpath 
    sqlfile=/var/lib/jenkins/jobs/Lakshmi-Testapp-PostgreSQL/workspace/target/lakshmi-std-cmp-opu.sql 
/> 

示例文件:

create table PersistentOrder (
    dbId int8 not null, 
    orderActionsBinary oid, 
    orderActionsText text, 
    orderIssuerId varchar(255), 
    orderIssuerName varchar(255), 
    orderType varchar(255), 
    returnType int4, 
    uuid varchar(255), 
    primary key (dbId) 
); 

create table REVINFO (
    REV int4 not null, 
    REVTSTMP int8, 
    primary key (REV) 
); 

如果我嘗試用psql或pgAdmin執行文件我沒有錯誤,但通過Ant執行時,我得到:

[sql] Executing resource: /var/lib/jenkins/jobs/Lakshmi-Testapp-PostgreSQL/workspace/target/lakshmi-std-cmp-opu.sql 
[sql] Failed to execute: create table if not exists PersistentOrder (dbId int8 not null, orderActionsBinary oid, orderActionsText text, orderIssuerId varchar(255), orderIssuerName varchar(255), orderType varchar(255), returnType int4, uuid varchar(255), primary key (dbId)) 
[sql] org.postgresql.util.PSQLException: ERROR: syntax error at or near "not" 
[sql] Position: 19 
[sql] Failed to execute: create table if not exists REVINFO (REV int4 not null, REVTSTMP int8, primary key (REV)) 
[sql] org.postgresql.util.PSQLException: ERROR: syntax error at or near "not" 
[sql] Position: 19 
[sql] Failed to execute: drop sequence if exists hibernate_sequence 
[sql] org.postgresql.util.PSQLException: ERROR: current transaction is aborted, commands ignored until end of transaction block 
[sql] Failed to execute: create sequence hibernate_sequence; 
[sql] org.postgresql.util.PSQLException: ERROR: current transaction is aborted, commands ignored until end of transaction block 
[sql] 0 of 4 SQL statements executed successfully 

任何提示?

回答

3

如果不存在

附帶9.1版本。你使用什麼版本?

+0

好的,謝謝,驅動程序是9.1但數據庫不是(持續集成系統有一箇舊的DB)。 – Matteo