public inbox for [email protected]
help / color / mirror / Atom feedRe: [EXTERNAL] Re: [PATCH] Support using "all" for the db user in pg_ident.conf
8+ messages / 4 participants
[nested] [flat]
* Re: [EXTERNAL] Re: [PATCH] Support using "all" for the db user in pg_ident.conf
@ 2023-01-19 11:23 Jelte Fennema <[email protected]>
0 siblings, 1 reply; 8+ messages in thread
From: Jelte Fennema @ 2023-01-19 11:23 UTC (permalink / raw)
To: Michael Paquier <[email protected]>; +Cc: Jelte Fennema <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; Nathan Bossart <[email protected]>; Andrew Dunstan <[email protected]>
Looks good to me. One tiny typo in a comment that I noticed when going
over the diff:
+ * Mark the token as quoted, so it will only be compared literally
+ * and not for some special meaning, such as "all" or a group
+ * membership checks.
should be either:
1. a group membership check
2. group membership checks
Now it's mixed singular and plural.
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [EXTERNAL] Re: [PATCH] Support using "all" for the db user in pg_ident.conf
@ 2023-01-20 02:26 Michael Paquier <[email protected]>
parent: Jelte Fennema <[email protected]>
0 siblings, 1 reply; 8+ messages in thread
From: Michael Paquier @ 2023-01-20 02:26 UTC (permalink / raw)
To: Jelte Fennema <[email protected]>; +Cc: Jelte Fennema <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; Nathan Bossart <[email protected]>; Andrew Dunstan <[email protected]>
On Thu, Jan 19, 2023 at 12:23:16PM +0100, Jelte Fennema wrote:
> should be either:
> 1. a group membership check
> 2. group membership checks
>
> Now it's mixed singular and plural.
Thanks, fixed. And now applied the last patch.
--
Michael
Attachments:
[application/pgp-signature] signature.asc (833B, ../../[email protected]/2-signature.asc)
download
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [EXTERNAL] Re: [PATCH] Support using "all" for the db user in pg_ident.conf
@ 2023-02-13 14:06 Pavel Luzanov <[email protected]>
parent: Michael Paquier <[email protected]>
0 siblings, 1 reply; 8+ messages in thread
From: Pavel Luzanov @ 2023-02-13 14:06 UTC (permalink / raw)
To: Michael Paquier <[email protected]>; Jelte Fennema <[email protected]>; +Cc: Jelte Fennema <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; Nathan Bossart <[email protected]>; Andrew Dunstan <[email protected]>
Hello,
Playing with this patch, I did not see descriptive comments in
pg_ident.conf.
Does it make sense to reflect changes to the PG-USERNAME field in the
pg_ident.conf.sample file?
The same relates to the regexp supportin the DATABASE and USER fieldsof
the pg_hba.conf.sample file(8fea8683).
-----
Pavel Luzanov
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [EXTERNAL] Re: [PATCH] Support using "all" for the db user in pg_ident.conf
@ 2023-02-13 14:13 Jelte Fennema <[email protected]>
parent: Pavel Luzanov <[email protected]>
0 siblings, 1 reply; 8+ messages in thread
From: Jelte Fennema @ 2023-02-13 14:13 UTC (permalink / raw)
To: Pavel Luzanov <[email protected]>; +Cc: Michael Paquier <[email protected]>; Jelte Fennema <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; Nathan Bossart <[email protected]>; Andrew Dunstan <[email protected]>
On Mon, 13 Feb 2023 at 15:06, Pavel Luzanov <[email protected]> wrote:
> Does it make sense to reflect changes to the PG-USERNAME field in the
> pg_ident.conf.sample file?
>
> The same relates to the regexp supportin the DATABASE and USER fieldsof
> the pg_hba.conf.sample file(8fea8683).
That definitely makes sense to me. When writing the patch I didn't
realise that there was also documentation in those files.
I think it also makes sense to include usage of (some of) the features
in the example files here:
https://www.postgresql.org/docs/devel/auth-username-maps.html
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [EXTERNAL] Re: [PATCH] Support using "all" for the db user in pg_ident.conf
@ 2023-02-15 07:11 Michael Paquier <[email protected]>
parent: Jelte Fennema <[email protected]>
0 siblings, 1 reply; 8+ messages in thread
From: Michael Paquier @ 2023-02-15 07:11 UTC (permalink / raw)
To: Jelte Fennema <[email protected]>; +Cc: Pavel Luzanov <[email protected]>; Jelte Fennema <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; Nathan Bossart <[email protected]>; Andrew Dunstan <[email protected]>
On Mon, Feb 13, 2023 at 03:13:04PM +0100, Jelte Fennema wrote:
> On Mon, 13 Feb 2023 at 15:06, Pavel Luzanov <[email protected]> wrote:
>> Does it make sense to reflect changes to the PG-USERNAME field in the
>> pg_ident.conf.sample file?
>>
>> The same relates to the regexp supportin the DATABASE and USER fieldsof
>> the pg_hba.conf.sample file(8fea8683).
Which comes down to blame me for both of them.
> That definitely makes sense to me. When writing the patch I didn't
> realise that there was also documentation in those files.
>
> I think it also makes sense to include usage of (some of) the features
> in the example files here:
> https://www.postgresql.org/docs/devel/auth-username-maps.html
Hmm, I am not sure that adding more examples in the sample files is
worth the duplication with the docs.
So, please find attached a patch to close the gap the sample files,
for both things, with descriptions of all the field values they can
use.
What do you think?
--
Michael
Attachments:
[text/x-diff] sample-descriptions.patch (2.1K, ../../[email protected]/2-sample-descriptions.patch)
download | inline diff:
diff --git a/src/backend/libpq/pg_hba.conf.sample b/src/backend/libpq/pg_hba.conf.sample
index 095e3b4cc0..fc448b5b7e 100644
--- a/src/backend/libpq/pg_hba.conf.sample
+++ b/src/backend/libpq/pg_hba.conf.sample
@@ -31,14 +31,15 @@
# - "hostnogssenc" is a TCP/IP socket that is not GSSAPI-encrypted
#
# DATABASE can be "all", "sameuser", "samerole", "replication", a
-# database name, or a comma-separated list thereof. The "all"
-# keyword does not match "replication". Access to replication
-# must be enabled in a separate record (see example below).
+# database name, a regular expression (if it starts with a slash (/))
+# or a comma-separated list thereof. The "all" keyword does not match
+# "replication". Access to replication must be enabled in a separate
+# record (see example below).
#
-# USER can be "all", a user name, a group name prefixed with "+", or a
-# comma-separated list thereof. In both the DATABASE and USER fields
-# you can also write a file name prefixed with "@" to include names
-# from a separate file.
+# USER can be "all", a user name, a group name prefixed with "+", a
+# regular expression (if it starts with a slash (/)) or a comma-separated
+# list thereof. In both the DATABASE and USER fields you can also write
+# a file name prefixed with "@" to include names from a separate file.
#
# ADDRESS specifies the set of hosts the record matches. It can be a
# host name, or it is made up of an IP address and a CIDR mask that is
diff --git a/src/backend/libpq/pg_ident.conf.sample b/src/backend/libpq/pg_ident.conf.sample
index 5d32684b28..f5225f26cd 100644
--- a/src/backend/libpq/pg_ident.conf.sample
+++ b/src/backend/libpq/pg_ident.conf.sample
@@ -29,6 +29,10 @@
# will be substituted for \1 (backslash-one) if present in
# PG-USERNAME.
#
+# PG-USERNAME can be "all", a user name, a group name prefixed with "+", or
+# a regular expression (if it starts with a slash (/)). If it is a regular
+# expression, the substring matching with \1 has no effect.
+#
# Multiple maps may be specified in this file and used by pg_hba.conf.
#
# No map names are defined in the default configuration. If all
[application/pgp-signature] signature.asc (833B, ../../[email protected]/3-signature.asc)
download
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [EXTERNAL] Re: [PATCH] Support using "all" for the db user in pg_ident.conf
@ 2023-02-15 10:05 Pavel Luzanov <[email protected]>
parent: Michael Paquier <[email protected]>
0 siblings, 1 reply; 8+ messages in thread
From: Pavel Luzanov @ 2023-02-15 10:05 UTC (permalink / raw)
To: Michael Paquier <[email protected]>; Jelte Fennema <[email protected]>; +Cc: Jelte Fennema <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; Nathan Bossart <[email protected]>; Andrew Dunstan <[email protected]>
On 15.02.2023 10:11, Michael Paquier wrote:
> Which comes down to blame me for both of them.
My only intention was to make postgres better.I'm sorry you took it that
way.
> So, please find attached a patch to close the gap the sample files,
> for both things, with descriptions of all the field values they can
> use.
A short and precise description. Nothing to add.Next time I will try to
offer a patch at once.
-----
Pavel Luzanov
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [EXTERNAL] Re: [PATCH] Support using "all" for the db user in pg_ident.conf
@ 2023-02-15 10:25 Michael Paquier <[email protected]>
parent: Pavel Luzanov <[email protected]>
0 siblings, 0 replies; 8+ messages in thread
From: Michael Paquier @ 2023-02-15 10:25 UTC (permalink / raw)
To: Pavel Luzanov <[email protected]>; +Cc: Jelte Fennema <[email protected]>; Jelte Fennema <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; Nathan Bossart <[email protected]>; Andrew Dunstan <[email protected]>
On Wed, Feb 15, 2023 at 01:05:04PM +0300, Pavel Luzanov wrote:
> On 15.02.2023 10:11, Michael Paquier wrote:
>> Which comes down to blame me for both of them.
>
> My only intention was to make postgres better.I'm sorry you took it that
> way.
You have no need to feel sorry about that. I really appreciate that
you took the time to report this issue, so don't worry. My point is
that I have committed this code, so basically it is my responsibility
to take care of its maintenance.
>> So, please find attached a patch to close the gap the sample files,
>> for both things, with descriptions of all the field values they can
>> use.
>
> A short and precise description. Nothing to add.Next time I will try to
> offer a patch at once.
If you have a proposal of patch, that's always nice to have, but you
should not feel obliged to do so, either.
Thanks a lot for the report, Pavel!
--
Michael
Attachments:
[application/pgp-signature] signature.asc (833B, ../../[email protected]/2-signature.asc)
download
^ permalink raw reply [nested|flat] 8+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded
@ 2026-07-02 04:34 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 8+ messages in thread
From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw)
Previously, test_custom_var_stats and test_custom_fixed_stats silently
skipped pgstat_register_kind() when not loaded via shared_preload_libraries.
This left the SQL functions callable without the kind registered, leading to NULL
dereferences in core pgstat functions.
Remove the early return and let pgstat_register_kind() error out naturally,
matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now
CREATE EXTENSION fails with a clear error if the module is not preloaded.
Author: Bertrand Drouvot <[email protected]>
Reviewed-by: Ewan Young <[email protected]>
Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg
---
.../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++-----
.../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++-----
2 files changed, 8 insertions(+), 10 deletions(-)
100.0% src/test/modules/test_custom_stats/
diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c
index a066ce117a6..8b29ca3e27a 100644
--- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c
+++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c
@@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = {
void
_PG_init(void)
{
- /* Must be loaded via shared_preload_libraries */
- if (!process_shared_preload_libraries_in_progress)
- return;
-
- /* Register custom statistics kind */
+ /*
+ * In order to register our custom statistics kind, we have to be loaded
+ * via shared_preload_libraries. Otherwise, registration will fail.
+ */
pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats);
}
diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c
index 863d6a52492..fa415c81301 100644
--- a/src/test/modules/test_custom_stats/test_custom_var_stats.c
+++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c
@@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = {
void
_PG_init(void)
{
- /* Must be loaded via shared_preload_libraries */
- if (!process_shared_preload_libraries_in_progress)
- return;
-
- /* Register custom statistics kind */
+ /*
+ * In order to register our custom statistics kind, we have to be loaded
+ * via shared_preload_libraries. Otherwise, registration will fail.
+ */
pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats);
}
--
2.34.1
--i51FQWZELabmlh2Y--
^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2026-07-02 04:34 UTC | newest]
Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-01-19 11:23 Re: [EXTERNAL] Re: [PATCH] Support using "all" for the db user in pg_ident.conf Jelte Fennema <[email protected]>
2023-01-20 02:26 ` Michael Paquier <[email protected]>
2023-02-13 14:06 ` Pavel Luzanov <[email protected]>
2023-02-13 14:13 ` Jelte Fennema <[email protected]>
2023-02-15 07:11 ` Michael Paquier <[email protected]>
2023-02-15 10:05 ` Pavel Luzanov <[email protected]>
2023-02-15 10:25 ` Michael Paquier <[email protected]>
2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox