Send multiple statements to pg server at once

From: Andy Fan <zhihuifan1213(at)163(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Send multiple statements to pg server at once
Date: 2025-03-11 07:23:07
Message-ID: 87pliof2uc.fsf@163.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I want to simulate a case where server receive "SELECT 1;SELECT 2;" at
once, so when executing exec_simple_query, the query_string is
"SELECT 1;SELECT 2;" However I found it is not easy to simulate, does
anyone has a suggestion?

I tried 'psql -f', checking 'psql/settings.h', at last I see below code
in psql/mainloop.c, I guess it is impossible in psql.

/*
* Send command if semicolon found, or if end of line and we're in
* single-line mode.
*/
if (scan_result == PSCAN_SEMICOLON ||
(scan_result == PSCAN_EOL && pset.singleline))
{

--
Best Regards
Andy Fan

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bertrand Drouvot 2025-03-11 07:25:17 Re: Allow CI to only run the compiler warnings task
Previous Message Ashutosh Bapat 2025-03-11 07:21:40 Re: SQL Property Graph Queries (SQL/PGQ)