pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Make psql's \password default to CURRENT_USER, not PQuser(conn).
6+ messages / 1 participants
[nested] [flat]

* pgsql: Make psql's \password default to CURRENT_USER, not PQuser(conn).
@ 2021-11-12 19:56  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2021-11-12 19:56 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Make psql's \password default to CURRENT_USER, not PQuser(conn).

The documentation says plainly that \password acts on "the current user"
by default.  What it actually acted on, or tried to, was the username
used to log into the current session.  This is not the same thing if
one has since done SET ROLE or SET SESSION AUTHENTICATION.  Aside from
the possible surprise factor, it's quite likely that the current role
doesn't have permissions to set the password of the original role.

To fix, use "SELECT CURRENT_USER" to get the role name to act on.
(This syntax works with servers at least back to 7.0.)  Also, in
hopes of reducing confusion, include the role name that will be
acted on in the password prompt.

The discrepancy from the documentation makes this a bug, so
back-patch to all supported branches.

Patch by me; thanks to Nathan Bossart for review.

Discussion: https://postgr.es/m/747443.1635536754@sss.pgh.pa.us

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/523adcc12900d67a3a43bc7ca4ef4e84f062bb9a

Modified Files
--------------
src/bin/psql/command.c | 34 +++++++++++++++++++++-------------
1 file changed, 21 insertions(+), 13 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Make psql's \password default to CURRENT_USER, not PQuser(conn).
@ 2021-11-12 19:56  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2021-11-12 19:56 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Make psql's \password default to CURRENT_USER, not PQuser(conn).

The documentation says plainly that \password acts on "the current user"
by default.  What it actually acted on, or tried to, was the username
used to log into the current session.  This is not the same thing if
one has since done SET ROLE or SET SESSION AUTHENTICATION.  Aside from
the possible surprise factor, it's quite likely that the current role
doesn't have permissions to set the password of the original role.

To fix, use "SELECT CURRENT_USER" to get the role name to act on.
(This syntax works with servers at least back to 7.0.)  Also, in
hopes of reducing confusion, include the role name that will be
acted on in the password prompt.

The discrepancy from the documentation makes this a bug, so
back-patch to all supported branches.

Patch by me; thanks to Nathan Bossart for review.

Discussion: https://postgr.es/m/747443.1635536754@sss.pgh.pa.us

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/3bc46e4e9d7a9da9a4cfa9795219509af79e93af

Modified Files
--------------
src/bin/psql/command.c | 34 +++++++++++++++++++++-------------
1 file changed, 21 insertions(+), 13 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Make psql's \password default to CURRENT_USER, not PQuser(conn).
@ 2021-11-12 19:56  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2021-11-12 19:56 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Make psql's \password default to CURRENT_USER, not PQuser(conn).

The documentation says plainly that \password acts on "the current user"
by default.  What it actually acted on, or tried to, was the username
used to log into the current session.  This is not the same thing if
one has since done SET ROLE or SET SESSION AUTHENTICATION.  Aside from
the possible surprise factor, it's quite likely that the current role
doesn't have permissions to set the password of the original role.

To fix, use "SELECT CURRENT_USER" to get the role name to act on.
(This syntax works with servers at least back to 7.0.)  Also, in
hopes of reducing confusion, include the role name that will be
acted on in the password prompt.

The discrepancy from the documentation makes this a bug, so
back-patch to all supported branches.

Patch by me; thanks to Nathan Bossart for review.

Discussion: https://postgr.es/m/747443.1635536754@sss.pgh.pa.us

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/843925fadbd8d450d00229647b1d6933a4aae5e8

Modified Files
--------------
src/bin/psql/command.c | 34 +++++++++++++++++++++-------------
1 file changed, 21 insertions(+), 13 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Make psql's \password default to CURRENT_USER, not PQuser(conn).
@ 2021-11-12 19:56  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2021-11-12 19:56 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Make psql's \password default to CURRENT_USER, not PQuser(conn).

The documentation says plainly that \password acts on "the current user"
by default.  What it actually acted on, or tried to, was the username
used to log into the current session.  This is not the same thing if
one has since done SET ROLE or SET SESSION AUTHENTICATION.  Aside from
the possible surprise factor, it's quite likely that the current role
doesn't have permissions to set the password of the original role.

To fix, use "SELECT CURRENT_USER" to get the role name to act on.
(This syntax works with servers at least back to 7.0.)  Also, in
hopes of reducing confusion, include the role name that will be
acted on in the password prompt.

The discrepancy from the documentation makes this a bug, so
back-patch to all supported branches.

Patch by me; thanks to Nathan Bossart for review.

Discussion: https://postgr.es/m/747443.1635536754@sss.pgh.pa.us

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/99389cb66bb743ef6b94edc77034bdd9bf5e9928

Modified Files
--------------
src/bin/psql/command.c | 34 +++++++++++++++++++++-------------
1 file changed, 21 insertions(+), 13 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Make psql's \password default to CURRENT_USER, not PQuser(conn).
@ 2021-11-12 19:56  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2021-11-12 19:56 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Make psql's \password default to CURRENT_USER, not PQuser(conn).

The documentation says plainly that \password acts on "the current user"
by default.  What it actually acted on, or tried to, was the username
used to log into the current session.  This is not the same thing if
one has since done SET ROLE or SET SESSION AUTHENTICATION.  Aside from
the possible surprise factor, it's quite likely that the current role
doesn't have permissions to set the password of the original role.

To fix, use "SELECT CURRENT_USER" to get the role name to act on.
(This syntax works with servers at least back to 7.0.)  Also, in
hopes of reducing confusion, include the role name that will be
acted on in the password prompt.

The discrepancy from the documentation makes this a bug, so
back-patch to all supported branches.

Patch by me; thanks to Nathan Bossart for review.

Discussion: https://postgr.es/m/747443.1635536754@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d6eb5a0c258d3da5471814bcc6ed6498129fee16

Modified Files
--------------
src/bin/psql/command.c | 34 +++++++++++++++++++++-------------
1 file changed, 21 insertions(+), 13 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Make psql's \password default to CURRENT_USER, not PQuser(conn).
@ 2021-11-12 19:56  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2021-11-12 19:56 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Make psql's \password default to CURRENT_USER, not PQuser(conn).

The documentation says plainly that \password acts on "the current user"
by default.  What it actually acted on, or tried to, was the username
used to log into the current session.  This is not the same thing if
one has since done SET ROLE or SET SESSION AUTHENTICATION.  Aside from
the possible surprise factor, it's quite likely that the current role
doesn't have permissions to set the password of the original role.

To fix, use "SELECT CURRENT_USER" to get the role name to act on.
(This syntax works with servers at least back to 7.0.)  Also, in
hopes of reducing confusion, include the role name that will be
acted on in the password prompt.

The discrepancy from the documentation makes this a bug, so
back-patch to all supported branches.

Patch by me; thanks to Nathan Bossart for review.

Discussion: https://postgr.es/m/747443.1635536754@sss.pgh.pa.us

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/b062ca508cd4ab701fffc892afd59e07cb7f0c9f

Modified Files
--------------
src/bin/psql/command.c | 34 +++++++++++++++++++++-------------
1 file changed, 21 insertions(+), 13 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2021-11-12 19:56 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-11-12 19:56 pgsql: Make psql's \password default to CURRENT_USER, not PQuser(conn). Tom Lane <tgl@sss.pgh.pa.us>
2021-11-12 19:56 pgsql: Make psql's \password default to CURRENT_USER, not PQuser(conn). Tom Lane <tgl@sss.pgh.pa.us>
2021-11-12 19:56 pgsql: Make psql's \password default to CURRENT_USER, not PQuser(conn). Tom Lane <tgl@sss.pgh.pa.us>
2021-11-12 19:56 pgsql: Make psql's \password default to CURRENT_USER, not PQuser(conn). Tom Lane <tgl@sss.pgh.pa.us>
2021-11-12 19:56 pgsql: Make psql's \password default to CURRENT_USER, not PQuser(conn). Tom Lane <tgl@sss.pgh.pa.us>
2021-11-12 19:56 pgsql: Make psql's \password default to CURRENT_USER, not PQuser(conn). Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox