pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #19002: `pg_isready` unexpectedly succeeds on incorrect `--dbname` and/or `--username`
4+ messages / 4 participants
[nested] [flat]

* BUG #19002: `pg_isready` unexpectedly succeeds on incorrect `--dbname` and/or `--username`
@ 2025-07-29 19:11  PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 4+ messages in thread

From: PG Bug reporting form @ 2025-07-29 19:11 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: samuelmarks@gmail.com

The following bug has been logged on the website:

Bug reference:      19002
Logged by:          Samuel Marks
Email address:      samuelmarks@gmail.com
PostgreSQL version: 17.5
Operating system:   macOS
Description:        

```
/  > pg_isready -U fff
/tmp:5432 - accepting connections
/  > pg_isready -U fff -d555
/tmp:5432 - accepting connections
```

(`fff` is not a user and `555` is not a db on my installation)



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

* Re: BUG #19002: `pg_isready` unexpectedly succeeds on incorrect `--dbname` and/or `--username`
@ 2025-07-29 19:54  Jacob Champion <jacob.champion@enterprisedb.com>
  parent: PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 4+ messages in thread

From: Jacob Champion @ 2025-07-29 19:54 UTC (permalink / raw)
  To: samuelmarks@gmail.com; pgsql-bugs@lists.postgresql.org

On Tue, Jul 29, 2025 at 12:45 PM PG Bug reporting form
<noreply@postgresql.org> wrote:
> /  > pg_isready -U fff
> /tmp:5432 - accepting connections
> /  > pg_isready -U fff -d555
> /tmp:5432 - accepting connections
> ```
>
> (`fff` is not a user and `555` is not a db on my installation)

Hi Samuel, this behavior is explained in the docs [1]:

> It is not necessary to supply correct user name, password, or database name values to obtain the server status; however, if incorrect values are provided, the server will log a failed connection attempt.

So it's essentially just a courtesy to whoever's watching your logs.

--Jacob

[1] https://www.postgresql.org/docs/current/app-pg-isready.html#APP-PG-ISREADY-NOTES





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

* Re: BUG #19002: `pg_isready` unexpectedly succeeds on incorrect `--dbname` and/or `--username`
@ 2025-07-30 03:01  Samuel Marks <samuelmarks@gmail.com>
  parent: Jacob Champion <jacob.champion@enterprisedb.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Samuel Marks @ 2025-07-30 03:01 UTC (permalink / raw)
  To: Jacob Champion <jacob.champion@enterprisedb.com>; +Cc: pgsql-bugs@lists.postgresql.org

Hmm I suppose that works, but really I was using it as a "can i connect"
check. Similar to https://github.com/eficode/wait-for or
https://github.com/wait4x/wait4x

It seems weird—unexpected to user—to accept dbname or user and not have a
non-zero exit code or something in stderr indicating failure…

Samuel Marks
Charity <https://sydneyscientific.org; | consultancy <https://offscale.io;
| open-source <https://github.com/offscale; | LinkedIn
<https://linkedin.com/in/samuelmarks;


On Tue, Jul 29, 2025 at 2:54 PM Jacob Champion <
jacob.champion@enterprisedb.com> wrote:

> On Tue, Jul 29, 2025 at 12:45 PM PG Bug reporting form
> <noreply@postgresql.org> wrote:
> > /  > pg_isready -U fff
> > /tmp:5432 - accepting connections
> > /  > pg_isready -U fff -d555
> > /tmp:5432 - accepting connections
> > ```
> >
> > (`fff` is not a user and `555` is not a db on my installation)
>
> Hi Samuel, this behavior is explained in the docs [1]:
>
> > It is not necessary to supply correct user name, password, or database
> name values to obtain the server status; however, if incorrect values are
> provided, the server will log a failed connection attempt.
>
> So it's essentially just a courtesy to whoever's watching your logs.
>
> --Jacob
>
> [1]
> https://www.postgresql.org/docs/current/app-pg-isready.html#APP-PG-ISREADY-NOTES
>

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

* Re: BUG #19002: `pg_isready` unexpectedly succeeds on incorrect `--dbname` and/or `--username`
@ 2025-07-30 03:27  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Samuel Marks <samuelmarks@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2025-07-30 03:27 UTC (permalink / raw)
  To: Samuel Marks <samuelmarks@gmail.com>; +Cc: Jacob Champion <jacob.champion@enterprisedb.com>; pgsql-bugs@lists.postgresql.org

Samuel Marks <samuelmarks@gmail.com> writes:
> Hmm I suppose that works, but really I was using it as a "can i connect"
> check.

That's explicitly not its job.  Why don't you just try to connect?
Or if you want a command-line tool, consider

	psql ...connection options... -c 'select 1'

			regards, tom lane





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


end of thread, other threads:[~2025-07-30 03:27 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-07-29 19:11 BUG #19002: `pg_isready` unexpectedly succeeds on incorrect `--dbname` and/or `--username` PG Bug reporting form <noreply@postgresql.org>
2025-07-29 19:54 ` Jacob Champion <jacob.champion@enterprisedb.com>
2025-07-30 03:01   ` Samuel Marks <samuelmarks@gmail.com>
2025-07-30 03:27     ` 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