"set autocommit on" in golang client query

Поиск
Список
Период
Сортировка
От Rory Campbell-Lange
Тема "set autocommit on" in golang client query
Дата
Msg-id YufQqOrQfuLALtMC@campbell-lange.net
обсуждение исходный текст
Ответы Re: "set autocommit on" in golang client query  (Guillaume Lelarge <guillaume@lelarge.info>)
Список pgsql-general
Apologies for the rather naive question.

I have a psql migration script to call a looping procedure which commits
batches of data along the following lines:

    set search_path = a, b c;
    \set AUTOCOMMIT on
    -- call procedure with nested transactions
    CALL c.pr_my_procedure(debug=>true);

I'm trying to migrate this to a programme using the golang pgx module to exec
this code on a large number of databases in parallel. There doesn't seem an
obvious way of setting autocommit outside of psql, so the equivalent of 

    conn.Exec(context.Background(),
              "set search_path = a, b c; set AUTOCOMMIT on; CALL c.pr_my_procedure(debug=>true);")

fails with

    ERROR: syntax error at or near "ON"

while

    conn.Exec(context.Background(),
              "set search_path = a, b c; CALL c.pr_my_procedure(debug=>true);")

fails with

    ERROR: invalid transaction termination

How should I set autocommit on? The "Create Procedure" docs at
https://www.postgresql.org/docs/current/sql-createprocedure.html don't seem to
mention autocommit.

Rory




В списке pgsql-general по дате отправления:

Предыдущее
От: howardnews@selestial.com
Дата:
Сообщение: Re: Connecting to postgres on OSX from Swift using PostgresClientKit
Следующее
От: Guillaume Lelarge
Дата:
Сообщение: Re: "set autocommit on" in golang client query