public inbox for [email protected]
help / color / mirror / Atom feedFrom: Dave Cramer <[email protected]>
To: James Pang <[email protected]>
Cc: [email protected]
Cc: Laurenz Albe <[email protected]>
Subject: Re: cached plan must not change result type
Date: Fri, 29 Mar 2024 11:45:09 -0400
Message-ID: <CADK3HHLkuDpfVKfzckH5z-e1_Z8DH-9WdOWaafbJ4HRuRqnsdg@mail.gmail.com> (raw)
In-Reply-To: <CAHgTRfeXGN9d7vgg8LtwpNYw_+f-zmMYsOc1U9rhXkGcwWtNng@mail.gmail.com>
References: <CAHgTRfcg2jGnjSqq1NVuMDtCjRU3aOXWrhXn1L=92Ka_Ug6euw@mail.gmail.com>
<[email protected]>
<CAHgTRfe+REHqYoQJ_ykj_p416PbdHz+UN06-R3PVr6auMx4w2g@mail.gmail.com>
<CAHgTRfeXGN9d7vgg8LtwpNYw_+f-zmMYsOc1U9rhXkGcwWtNng@mail.gmail.com>
On Fri, 29 Mar 2024 at 05:09, James Pang <[email protected]> wrote:
> forwarded to pgjdbc, we want to understand why JDBC failed to reexecute
> the SQL instead of throw error out. Like this document
> https://jdbc.postgresql.org/documentation/server-prepare/#re-execution-of-failed-statements
> .
>
>
>
> protected final void execute(CachedQuery cachedQuery,
> @Nullable ParameterList queryParameters, int flags)
> throws SQLException {
> try {
> executeInternal(cachedQuery, queryParameters, flags);
> } catch (SQLException e) {
> // Don't retry composite queries as it might get partially executed
> if (cachedQuery.query.getSubqueries() != null
> <<< no idea how this cachedQuery.query.getSubqueries() != null
> || !connection.getQueryExecutor().willHealOnRetry(e)) {
> throw e;
> }
> cachedQuery.query.close();
> // Execute the query one more time
> executeInternal(cachedQuery, queryParameters, flags);
> }
> }
>
> cachedQuery.query.getSubqueries() != null, how this code decide composite
> queries here ? that mean some query having subquery or having many JOIN
> or LEFT JOINs like select .... A left join B ...
>
> Thanks,
>
> James
>
This is really an issue that needs to be solved in the backend. The error
is coming from PostgreSQL and what should happen is that when you alter a
table that a server prepared statement relies on the backend should send a
message to tell us that all of the prepared statements that rely on are now
invalid and we can reprepare them. Currently the driver has no idea that
you changed the table and the prepared statement will fail so it just
continues to use it.
Dave
view thread (13+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: cached plan must not change result type
In-Reply-To: <CADK3HHLkuDpfVKfzckH5z-e1_Z8DH-9WdOWaafbJ4HRuRqnsdg@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox