Re: Can I test Extended Query in core test framework - Mailing list pgsql-hackers

From Ashutosh Bapat
Subject Re: Can I test Extended Query in core test framework
Date
Msg-id CAExHW5viLbPJ_asUrocqw8_0LDwS-0EZwa4FGvf4SUiQirVwhQ@mail.gmail.com
Whole thread Raw
In response to Can I test Extended Query in core test framework  (Andy Fan <zhihui.fan1213@gmail.com>)
Responses Re: Can I test Extended Query in core test framework  (Andy Fan <zhihui.fan1213@gmail.com>)
List pgsql-hackers
You could run PREPARE and EXECUTE as SQL commands from psql. Please
take a look at the documentation of those two commands. I haven't
looked at TAP infrastructure, but you could open a psql session to a
running server and send an arbitrary number of SQL queries through it.

Said that a server starts caching plan only after it sees a certain
number of EXECUTEs. So if you are testing cached plans, that's
something to worry about.

On Tue, Aug 11, 2020 at 8:13 AM Andy Fan <zhihui.fan1213@gmail.com> wrote:
>
> I want to write some test cases with extended query in core test system. basically it looks like
>
> PreparedStatement preparedStatement  = conn.prepareStatement("select * from bigtable");
> preparedStatement.setFetchSize(4);
> ResultSet rs = preparedStatement.executeQuery();
> while(rs.next())
> {
>     System.out.println(rs.getInt(1));
>     // conn.commit();
>     conn.rollback();
> }
>
>
> However I don't find a way to do that after checking the example in src/test/xxx/t/xxx.pl
> where most often used object is PostgresNode, which don't have such abilities.
>
> Can I do that in core system, I tried grep '\->prepare'  and  '\->execute' and get nothing.
> am I miss something?
>
>
> --
> Best Regards
> Andy Fan



-- 
Best Wishes,
Ashutosh Bapat



pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: EDB builds Postgres 13 with an obsolete ICU version
Next
From: Bharath Rupireddy
Date:
Subject: Inconsistent behavior of smart shutdown handling for queries with and without parallel workers