BUG #16290: Unable to run \set AUTOCOMMIT off - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #16290: Unable to run \set AUTOCOMMIT off
Date
Msg-id 16290-6905a3cd1575acc1@postgresql.org
Whole thread Raw
Responses Re: BUG #16290: Unable to run \set AUTOCOMMIT off
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      16290
Logged by:          apoorv malik
Email address:      apoorvmalik.appy@gmail.com
PostgreSQL version: 11.6
Operating system:   Linux
Description:

Hi,
I'm using Liquibase and trying to run multiple sql files. In the first sql
file, I want to define '\set AUTOCOMMIT off' so that I can rollback. 
This will be used for testing. Unfortunately, I can't use BEGIN; as there
are multiple files and can't be combined to one else Liquibase will not have
separate entries.

Could you please give me equivalent command for \set AUTOCOMMIT off -->  I
have tried all types of escaping but nothing seems to work.

set AUTOCOMMIT = off -->this works fine in Liquibase but fails at DB 

Here's the error:

Reason: liquibase.exception.DatabaseException: ERROR: syntax error at or
near "\"
  Position: 1 [Failed SQL: (0) \set AUTOCOMMIT off]
    at liquibase.changelog.ChangeSet.execute(ChangeSet.java:646)
    at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:53)
    at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:83)
    at liquibase.Liquibase.update(Liquibase.java:202)
    at liquibase.Liquibase.update(Liquibase.java:179)
    at liquibase.integration.commandline.Main.doMigration(Main.java:1399)
    at liquibase.integration.commandline.Main.run(Main.java:229)
    at liquibase.integration.commandline.Main.main(Main.java:143)
Caused by: liquibase.exception.DatabaseException: ERROR: syntax error at or
near "\"
  Position: 1 [Failed SQL: (0) \set AUTOCOMMIT off]
    at
liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:402)
    at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:59)
    at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:131)
    at
liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1274)
    at
liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1256)
    at liquibase.changelog.ChangeSet.execute(ChangeSet.java:609)
    ... 7 common frames omitted
Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near
"\"
  Position: 1
    at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440)
    at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183)
    at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:308)
    at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)
    at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)
    at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:307)
    at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:293)
    at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:270)
    at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:266)
    at
liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:398)
    ... 12 common frames omitted


pgsql-bugs by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: BUG #16285: bt_metap fails with value is out of range for type integer
Next
From: "David G. Johnston"
Date:
Subject: Re: BUG #16290: Unable to run \set AUTOCOMMIT off