public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: Renan Alves Fonseca <[email protected]>
Cc: David Rowley <[email protected]>
Cc: Evgeny Morozov <[email protected]>
Cc: pgsql-general <[email protected]>
Subject: Re: Querying one partition in a function takes locks on all partitions
Date: Mon, 31 Mar 2025 13:21:07 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAN_p2QjXkBzyx55QAEGLfvWF0_UdusvxNmTykq_6jQsaaqjwTw@mail.gmail.com>
References: <01020195b987abd3-a008b77d-8c63-4931-80a4-be36a351c8b2-000000@eu-west-1.amazonses.com>
	<CAN_p2Qi_zie4aZqMcYuT-Y5CxyvUJ+nBAomQNJSPbBjrCPEXJw@mail.gmail.com>
	<01020195dd9e8337-c912f36d-54ef-4d3c-a00d-5e697b308d33-000000@eu-west-1.amazonses.com>
	<CAN_p2QghEHKeyTvb6Gc8F3y6wNm+dJXaCdrAnrV7TEq15Oh-pg@mail.gmail.com>
	<CAApHDvp3EDrVhGjmb21bceJ5-Y7iXKOn2UGG3-ngp_9ob_mpLw@mail.gmail.com>
	<CAN_p2QjXkBzyx55QAEGLfvWF0_UdusvxNmTykq_6jQsaaqjwTw@mail.gmail.com>

Renan Alves Fonseca <[email protected]> writes:
> There is a Note that says: "The entire body of an SQL function is
> parsed before any of it is executed. While an SQL function can contain
> commands that alter ..."

Yup.

> If I understood well [2], then both notes may be discarded together in
> the next version.

No, that aspect is not changed in the currently-proposed patch:
we still do parse analysis of all the queries at the beginning.
I'd like to make it work differently eventually, but with feature
freeze so close I do not think that'll happen for v18.

Thinking a bit more about that, if the initial parse analysis succeeds
then the patched code will in fact re-parse before execution if any
DDL changes have occurred.  So you get at least some of the desired
behavioral change.  But the example given in the docs would still
fail, so I don't feel a need to change the docs yet.

			regards, tom lane






view thread (6+ messages)

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: Querying one partition in a function takes locks on all partitions
  In-Reply-To: <[email protected]>

* 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