pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql --echo-errors --quiet and setval
5+ messages / 4 participants
[nested] [flat]

* pgsql --echo-errors --quiet and setval
@ 2023-09-08 19:36  Les <nagylzs@gmail.com>
  0 siblings, 2 replies; 5+ messages in thread

From: Les @ 2023-09-08 19:36 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

  Dear fellow PostgreSQL users,

Today I caught this with postgresql v15, while restoring a database with
psql  --echo-errors --quiet. (The dump was made using pg_dump -Fp).

It logged lots of these messages:

 setval
--------
   1001
(1 row)

In other words, it logs **some** things that are not errors, even though
--quiet was specified. Is this the expected behaviour? I would argue that
with --quiet --echo-errors, only errors should be logged, and setting the
value of a sequence is not an error.

Thank you,

    Laszlo

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

* Re: pgsql --echo-errors --quiet and setval
@ 2023-09-08 20:11  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Les <nagylzs@gmail.com>
  1 sibling, 0 replies; 5+ messages in thread

From: Adrian Klaver @ 2023-09-08 20:11 UTC (permalink / raw)
  To: Les <nagylzs@gmail.com>; pgsql-general@lists.postgresql.org

On 9/8/23 12:36, Les wrote:
> 
>    Dear fellow PostgreSQL users,
> 
> Today I caught this with postgresql v15, while restoring a database with 
> psql  --echo-errors --quiet. (The dump was made using pg_dump -Fp).
> 
> It logged lots of these messages:
> 
>   setval
> --------
>     1001
> (1 row)
> 
> In other words, it logs **some** things that are not errors, even though 
> --quiet was specified. Is this the expected behaviour? I would argue 
> that with --quiet --echo-errors, only errors should be logged, and 
> setting the value of a sequence is not an error.

No but SELECT pg_catalog.setval(...) in the dump file is a function that 
has return value and that is what you are seeing.

> 
> Thank you,
> 
>      Laszlo
> 

-- 
Adrian Klaver
adrian.klaver@aklaver.com






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

* Re: pgsql --echo-errors --quiet and setval
@ 2023-09-08 22:01  David G. Johnston <david.g.johnston@gmail.com>
  parent: Les <nagylzs@gmail.com>
  1 sibling, 1 reply; 5+ messages in thread

From: David G. Johnston @ 2023-09-08 22:01 UTC (permalink / raw)
  To: Les <nagylzs@gmail.com>; +Cc: pgsql-general@lists.postgresql.org

On Fri, Sep 8, 2023 at 1:41 PM Les <nagylzs@gmail.com> wrote:

>
>   Dear fellow PostgreSQL users,
>
> Today I caught this with postgresql v15, while restoring a database with
> psql  --echo-errors --quiet. (The dump was made using pg_dump -Fp).
>
> It logged lots of these messages:
>
>  setval
> --------
>    1001
> (1 row)
>
> In other words, it logs **some** things that are not errors, even though
> --quiet was specified. Is this the expected behaviour? I would argue that
> with --quiet --echo-errors, only errors should be logged, and setting the
> value of a sequence is not an error.
>

The output of SELECT queries cannot be quieted, only redirected.

David J.

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

* Re: pgsql --echo-errors --quiet and setval
@ 2023-09-10 17:43  Tom Lane <tgl@sss.pgh.pa.us>
  parent: David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Tom Lane @ 2023-09-10 17:43 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: Les <nagylzs@gmail.com>; pgsql-general@lists.postgresql.org

"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Fri, Sep 8, 2023 at 1:41 PM Les <nagylzs@gmail.com> wrote:
>> Today I caught this with postgresql v15, while restoring a database with
>> psql  --echo-errors --quiet. (The dump was made using pg_dump -Fp).
>> It logged lots of these messages:
>> 
>> setval
>> --------
>> 1001
>> (1 row)
>> 
>> In other words, it logs **some** things that are not errors, even though
>> --quiet was specified. Is this the expected behaviour? I would argue that
>> with --quiet --echo-errors, only errors should be logged, and setting the
>> value of a sequence is not an error.

> The output of SELECT queries cannot be quieted, only redirected.

Yeah.  You could do "\o /dev/null" or the equivalent to discard the
SELECT results, since a pg_dump script isn't going to be doing anything
that you really need to see the results of.

I'm not sure whether it'd be profitable to try to build that behavior
into the scripts themselves.  One problem is that "/dev/null" doesn't
have that name on Windows, so it's hard to see how to invoke the behavior
in a platform-agnostic fashion.

			regards, tom lane





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

* Re: pgsql --echo-errors --quiet and setval
@ 2023-09-10 17:50  David G. Johnston <david.g.johnston@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: David G. Johnston @ 2023-09-10 17:50 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Les <nagylzs@gmail.com>; pgsql-general@lists.postgresql.org

On Sun, Sep 10, 2023 at 10:43 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:

> I'm not sure whether it'd be profitable to try to build that behavior
>
into the scripts themselves.


Teaching it not to call "print" (or making it a no-op somehow) in a certain
mode, yes, trying to redirect output it is producing, I doubt it for the
reason mentioned.  It isn't difficult to add "> /dev/null" to the command
line if that is what you want - no need to touch scripts given a capable
enough shell.

David J.

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


end of thread, other threads:[~2023-09-10 17:50 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-09-08 19:36 pgsql --echo-errors --quiet and setval Les <nagylzs@gmail.com>
2023-09-08 20:11 ` Adrian Klaver <adrian.klaver@aklaver.com>
2023-09-08 22:01 ` David G. Johnston <david.g.johnston@gmail.com>
2023-09-10 17:43   ` Tom Lane <tgl@sss.pgh.pa.us>
2023-09-10 17:50     ` David G. Johnston <david.g.johnston@gmail.com>

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