Skip to content

Commit 1d01d19

Browse files
committed
Fix new auto_explain test case for Windows.
In commit 7c34555, I overlooked the need to configure SSPI on Windows to allow login as the non-superuser role. Fix that by adding auth_extra/--create-role incantation (which, oddly enough, doesn't actually create the role). Per buildfarm. While here, upgrade the mechanism for temporarily setting $ENV{PGUSER}, as per recommendation from ilmari. Discussion: https://postgr.es/m/87edy7j1zz.fsf@wibble.ilmari.org
1 parent a0c632c commit 1d01d19

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

contrib/auto_explain/t/001_auto_explain.pl

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ sub query_log
2828
}
2929

3030
my $node = PostgreSQL::Test::Cluster->new('main');
31-
$node->init;
31+
$node->init('auth_extra' => [ '--create-role', 'regress_user1' ]);
3232
$node->append_conf('postgresql.conf',
3333
"session_preload_libraries = 'auto_explain'");
3434
$node->append_conf('postgresql.conf', "auto_explain.log_min_duration = 0");
@@ -115,29 +115,30 @@ sub query_log
115115
GRANT SET ON PARAMETER auto_explain.log_format TO regress_user1;
116116
});
117117

118-
$ENV{PGUSER} = "regress_user1";
118+
{
119+
local $ENV{PGUSER} = "regress_user1";
119120

120-
$log_contents = query_log(
121-
$node,
122-
"SELECT * FROM pg_database;",
123-
{ "auto_explain.log_format" => "json" });
121+
$log_contents = query_log(
122+
$node,
123+
"SELECT * FROM pg_database;",
124+
{ "auto_explain.log_format" => "json" });
124125

125-
like(
126-
$log_contents,
127-
qr/"Query Text": "SELECT \* FROM pg_database;"/,
128-
"query text logged, json mode selected by non-superuser");
126+
like(
127+
$log_contents,
128+
qr/"Query Text": "SELECT \* FROM pg_database;"/,
129+
"query text logged, json mode selected by non-superuser");
129130

130-
$log_contents = query_log(
131-
$node,
132-
"SELECT * FROM pg_database;",
133-
{ "auto_explain.log_level" => "log" });
131+
$log_contents = query_log(
132+
$node,
133+
"SELECT * FROM pg_database;",
134+
{ "auto_explain.log_level" => "log" });
134135

135-
like(
136-
$log_contents,
137-
qr/WARNING: permission denied to set parameter "auto_explain\.log_level"/,
138-
"permission failure logged");
136+
like(
137+
$log_contents,
138+
qr/WARNING: permission denied to set parameter "auto_explain\.log_level"/,
139+
"permission failure logged");
139140

140-
$ENV{PGUSER} = undef;
141+
} # end queries run as regress_user1
141142

142143
$node->safe_psql(
143144
"postgres", q{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy