You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi
I found when sending multiple statements separated by ';\n' in one query, they will be included in one single transaction on Postgres. And I tried to do the similar thing via plsql or Java JDBC Framework , these statements will be separated into different transactions respectively. I just want to confirm if it is as expected?
ENV: pgmoon 1.16.0-1
Here is my test case:
local pgmoon = require("pgmoon")
local pg = pgmoon.new({
host = "127.0.0.1",
port = "5432",
database = "db",
user = "dbuser",
password = "pass",
})
assert(pg:connect())
statements = [[
DELETE FROM "events" WHERE "expire_at" < CURRENT_TIMESTAMP AT TIME ZONE 'UTC';
DELETE FROM "audit_log" WHERE "ttl" < CURRENT_TIMESTAMP AT TIME ZONE 'UTC';
]]
assert(pg:query(statements))
The query log output on Postgres:
STATEMENT: DELETE FROM "events" WHERE "expire_at" < CURRENT_TIMESTAMP AT TIME ZONE 'UTC';
DELETE FROM "audit_log" WHERE "ttl" < CURRENT_TIMESTAMP AT TIME ZONE 'UTC';
The text was updated successfully, but these errors were encountered:
This is expected, this is functionality of the postgres simple query protocol. If you use the extended protocol then you can only issue one query at a time.
Hi
I found when sending multiple statements separated by ';\n' in one query, they will be included in one single transaction on Postgres. And I tried to do the similar thing via plsql or Java JDBC Framework , these statements will be separated into different transactions respectively. I just want to confirm if it is as expected?
ENV: pgmoon 1.16.0-1
Here is my test case:
The query log output on Postgres:
The text was updated successfully, but these errors were encountered: