Re: [PATCH] Support Int64 GUCs - Mailing list pgsql-hackers

From Li Japin
Subject Re: [PATCH] Support Int64 GUCs
Date
Msg-id C6C1FCFD-0E75-42EB-BF96-9DADC9C07208@hotmail.com
Whole thread Raw
In response to Re: [PATCH] Support Int64 GUCs  (Alexander Korotkov <aekorotkov@gmail.com>)
Responses Re: [PATCH] Support Int64 GUCs
List pgsql-hackers

On Sep 25, 2024, at 19:03, Aleksander Alekseev <aleksander@timescale.com> wrote:

Hi,

I found the autovacuum_vacuum_threshold, autovacuum_vacuum_insert_threshold
and autovacuum_analyze_threshold is change to int64 for relation option,
however the GUCs are still integers.

```
postgres=# select * from pg_settings where name = 'autovacuum_vacuum_threshold' \gx
-[ RECORD 1 ]---+------------------------------------------------------------
name            | autovacuum_vacuum_threshold
setting         | 50
unit            |
category        | Autovacuum
short_desc      | Minimum number of tuple updates or deletes prior to vacuum.
extra_desc      |
context         | sighup
vartype         | integer
source          | default
min_val         | 0
max_val         | 2147483647
enumvals        |
boot_val        | 50
reset_val       | 50
sourcefile      |
sourceline      |
pending_restart | f
```

Is there something I missed?

No, you found a bug. The patch didn't change ConfigureNamesInt64[]
thus these GUCs were still treated as int32s.

Here is the corrected patch v3. Thanks!

=# select * from pg_settings where name = 'autovacuum_vacuum_threshold';
-[ RECORD 1 ]---+------------------------------------------------------------
name            | autovacuum_vacuum_threshold
setting         | 1234605616436508552
unit            |
category        | Autovacuum
short_desc      | Minimum number of tuple updates or deletes prior to vacuum.
extra_desc      |
context         | sighup
vartype         | int64
source          | configuration file
min_val         | 0
max_val         | 9223372036854775807
enumvals        |
boot_val        | 50
reset_val       | 1234605616436508552
sourcefile      | /Users/eax/pginstall/data-master/postgresql.conf
sourceline      | 664
pending_restart | f


Thanks for updating the patch.

After testing the v3 patch, I found it cannot correctly handle the number with underscore.

See:

```
postgres=# alter system set autovacuum_vacuum_threshold to 2_147_483_648;
ERROR:  invalid value for parameter "autovacuum_vacuum_threshold": "2_147_483_648"
postgres=# alter system set autovacuum_vacuum_threshold to 2_147_483_647;
ALTER SYSTEM
```

IIRC, the lexer only supports integers but not int64.

--
Best regards,
Japin Li

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Add contrib/pg_logicalsnapinspect
Next
From: Tom Lane
Date:
Subject: Re: BUG #18097: Immutable expression not allowed in generated at