Skip to content

Commit 5253519

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 5f858dd commit 5253519

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");
@@ -152,29 +152,30 @@ sub query_log
152152
GRANT SET ON PARAMETER auto_explain.log_format TO regress_user1;
153153
});
154154

155-
$ENV{PGUSER} = "regress_user1";
155+
{
156+
local $ENV{PGUSER} = "regress_user1";
156157

157-
$log_contents = query_log(
158-
$node,
159-
"SELECT * FROM pg_database;",
160-
{ "auto_explain.log_format" => "json" });
158+
$log_contents = query_log(
159+
$node,
160+
"SELECT * FROM pg_database;",
161+
{ "auto_explain.log_format" => "json" });
161162

162-
like(
163-
$log_contents,
164-
qr/"Query Text": "SELECT \* FROM pg_database;"/,
165-
"query text logged, json mode selected by non-superuser");
163+
like(
164+
$log_contents,
165+
qr/"Query Text": "SELECT \* FROM pg_database;"/,
166+
"query text logged, json mode selected by non-superuser");
166167

167-
$log_contents = query_log(
168-
$node,
169-
"SELECT * FROM pg_database;",
170-
{ "auto_explain.log_level" => "log" });
168+
$log_contents = query_log(
169+
$node,
170+
"SELECT * FROM pg_database;",
171+
{ "auto_explain.log_level" => "log" });
171172

172-
like(
173-
$log_contents,
174-
qr/WARNING: permission denied to set parameter "auto_explain\.log_level"/,
175-
"permission failure logged");
173+
like(
174+
$log_contents,
175+
qr/WARNING: permission denied to set parameter "auto_explain\.log_level"/,
176+
"permission failure logged");
176177

177-
$ENV{PGUSER} = undef;
178+
} # end queries run as regress_user1
178179

179180
$node->safe_psql(
180181
"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