Re: Improve explicit cursor handling in pg_stat_statements

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Sami Imseih <samimseih(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Improve explicit cursor handling in pg_stat_statements
Date: 2025-06-05 01:00:42
Message-ID: aEDsOuo4OuuvhhoU@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 04, 2025 at 11:51:56AM -0500, Sami Imseih wrote:
>> An enum would shine here IMO, because the value could be
>> self-documented and one would not need to guess what each integer
>> value means. That could be something like a direction_keyword, filled
>> with FETCH_KEYWORD_LAST, FETCH_KEYWORD_BACKWARD, etc.
>
> Done in v4.

Mostly good here, some more comments.

+ * If an direction_keyword (i.e., FETCH FORWARD) is used, set this field
+ * to distinguish it from its numeric counterpart (i.e., FETCH 1). This
+ * value is set only within gram.y.

One nitpick comment here is that I would have mentioned that this
matters for query jumbling.

The tests can be in cursors.sql and not utility.sql, which is the test
area for... Cursors. :D

FetchDirectionKeywords could be in typedefs.list to avoid the
indentation accident with the structure definition. There's no actual
practice about that for committers, this note will just serve as a
self-reminder once the v19 branch opens for business when I handle
this patch.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Shinya Kato 2025-06-05 01:04:23 Re: Partitioned tables and [un]loggedness
Previous Message Joe Conway 2025-06-05 01:00:26 Re: Custom Glibc collation version strings under LOCPATH