Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rb3ii-00Crg5-Hb for pgsql-hackers@arkaria.postgresql.org; Fri, 16 Feb 2024 19:18:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rb3ih-003eHO-2q for pgsql-hackers@arkaria.postgresql.org; Fri, 16 Feb 2024 19:17:59 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rb3ig-003eBr-OD for pgsql-hackers@lists.postgresql.org; Fri, 16 Feb 2024 19:17:58 +0000 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rb3id-0075vd-Hp for pgsql-hackers@postgresql.org; Fri, 16 Feb 2024 19:17:57 +0000 Received: by mail-pg1-x531.google.com with SMTP id 41be03b00d2f7-5d3912c9a83so1788961a12.3 for ; Fri, 16 Feb 2024 11:17:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hagander.net; s=mail; t=1708111074; x=1708715874; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=NFIMwwHZEu+vWBoo29tOCD3mz/X+4HnDEmm+lMyNANI=; b=QFVUADxPoUGhxrXLh9qu/lKG0tP0b67G74wv71cmZMLBnWi6Lvx/dvNH1mD2hPfTLC +Tveebfqm2g/9rg4eVHuv5Xpd0dySy15DZu7MhWhEyLtdM+YliJPzkXfPYz9X0jzx+me NCXOVBcgNlhrzz2/+JYJL19ifzsRxrcLslut5jshuqLVoA409Xa5hGTVTKbE4CD2oUgi hk8zyYh0Iv2QnMbStiE35eEHQ3emixFknW9e/Ck3eWMwsfZc+dpnNgWwYUIP0mLApxlU 1fv3tAY9KMQhV10Je9wv1rqj2Yir3m7sAL284Zp/WRvsv0qsnREtsnYOTjt6JrkdGnF3 +jnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708111074; x=1708715874; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NFIMwwHZEu+vWBoo29tOCD3mz/X+4HnDEmm+lMyNANI=; b=Nh7bq6DSKVcNTeU1nS5cuyaXmY1RNHopeZwD9+5YQyJNDV0enijQ9zbSpgoJ5WSnn7 w4RotGlRYl7FGroFhdNPzwa2iL7wYyPcS+nrbqUzVQRKPit3BBfKgrAQ48d+233AtFXf iAfOOIGL78Ijkr64rvYkr4BR2AJKIVLCq34+8QtKZh2clUtoVEgKCCrRRB6dXPi4sRK4 SCSIEm6wrP67fTwl+/50aCpuswCj3MQPBfciAubDYy3Om9SSjpO8XVs0XoC381ZFnCsH zHWLg9HHxv63NM1naPlHDexZ+y4b3io6VHyrwdB4xsIb9T04+MpK5T4uCC0NHSGWfz9d jMIw== X-Forwarded-Encrypted: i=1; AJvYcCWRMhMUClSOouQiTDkTv3OcC4VMcaNjA5m8YiBxZUgOoQLRL3vBWK7dWPlXdj7kVxDElmgArx5Lm8PBW3q9JujV8sqR6Raq77gJGdO1 X-Gm-Message-State: AOJu0Yx/t3WdQIOSHZviFiT3j/OQy+4WoI14mS27MSJGs7vY902AuPHn 6FYBgcV5B/hqaxsCQqKIas9dejuLFOVl5yDMIj/q5g7Dzm344LYj39gB2DtfBi8q8sAXtIu5b/G 0KWfmPlyk4iwFbX2WyFpRxpM1z5YRFgXU6oL3 X-Google-Smtp-Source: AGHT+IGU/J5KQdnSILToqiNAOCEgPlXC6xI0aLDnumlifuJcPAYSCjlvX5Fbn3ZevjyJt8zy/CT4xJvlya8zmRr8UqI= X-Received: by 2002:a17:90b:2398:b0:299:3174:74df with SMTP id mr24-20020a17090b239800b00299317474dfmr2874527pjb.20.1708111074263; Fri, 16 Feb 2024 11:17:54 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Magnus Hagander Date: Fri, 16 Feb 2024 20:17:41 +0100 Message-ID: Subject: Re: System username in pg_stat_activity To: Bertrand Drouvot Cc: Aleksander Alekseev , PostgreSQL-development Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Jan 19, 2024 at 7:20=E2=80=AFAM Bertrand Drouvot wrote: > > Hi, > > On Thu, Jan 18, 2024 at 04:01:33PM +0100, Magnus Hagander wrote: > > On Mon, Jan 15, 2024 at 11:17=E2=80=AFAM Bertrand Drouvot > > > Did you forget to share the new revision (aka v4)? I can only see the > > > "reorder_parallel_worker_bestart.patch" attached. > > > > I did. Here it is, and also including that suggested docs fix as well > > as a rebase on current master. > > > > Thanks! > > Just a few comments: > > 1 =3D=3D=3D > > + The authentication method used for authenticating the connection,= or > + NULL for background processes. > > What about? "NULL for background processes (except for parallel workers w= hich > inherit this information from their leader process)" Ugh. That doesn't read very well at all to me. Maybe just "NULL for background processes without a user"? > 2 =3D=3D=3D > > + cycle before they were assigned a database role. Contains the sa= me > + value as the identity part in , o= r NULL > + for background processes. > > Same comment about parallel workers. > > 3 =3D=3D=3D > > +# pg_stat_activity should contain trust and empty string for trust auth > +$res =3D $node->safe_psql( > + 'postgres', > + "SELECT auth_method, auth_identity=3D'' FROM pg_stat_activity WHE= RE pid=3Dpg_backend_pid()", > + connstr =3D> "user=3Dscram_role"); > +is($res, 'trust|t', 'Users with trust authentication should show correct= ly in pg_stat_activity'); > + > +# pg_stat_activity should contain NULL for auth of background processes > +# (test is a bit out of place here, but this is where the other pg_stat_= activity.auth* tests are) > +$res =3D $node->safe_psql( > + 'postgres', > + "SELECT auth_method IS NULL, auth_identity IS NULL FROM pg_stat_a= ctivity WHERE backend_type=3D'checkpointer'", > +); > +is($res, 't|t', 'Background processes should show NULL for auth in pg_st= at_activity'); > > What do you think about testing the parallel workers cases too? (I'm not = 100% > sure it's worth the extra complexity though). I'm leaning towards not worth that. --=20 Magnus Hagander Me: https://www.hagander.net/ Work: https://www.redpill-linpro.com/