pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pg_dump save command in output
10+ messages / 5 participants
[nested] [flat]

* pg_dump save command in output
@ 2021-10-03 16:56  Joao Miguel Ferreira <joao.miguel.c.ferreira@gmail.com>
  0 siblings, 2 replies; 10+ messages in thread

From: Joao Miguel Ferreira @ 2021-10-03 16:56 UTC (permalink / raw)
  To: pgsql-general <pgsql-general@lists.postgresql.org>

Hello all,

is there a way to ask pg_dump to save a comment in the output file with the
full command it is executing ?

thank you
Joao

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

* Re: pg_dump save command in output
@ 2021-10-03 17:03  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Joao Miguel Ferreira <joao.miguel.c.ferreira@gmail.com>
  1 sibling, 1 reply; 10+ messages in thread

From: Adrian Klaver @ 2021-10-03 17:03 UTC (permalink / raw)
  To: Joao Miguel Ferreira <joao.miguel.c.ferreira@gmail.com>; pgsql-general <pgsql-general@lists.postgresql.org>

On 10/3/21 9:56 AM, Joao Miguel Ferreira wrote:
> Hello all,
> 
> is there a way to ask pg_dump to save a comment in the output file with 
> the full command it is executing ?

No.

What information is the comment trying to convey?

Are you dumping in plain or custom format?

> 
> thank you
> Joao
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





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

* Re: pg_dump save command in output
@ 2021-10-03 17:15  Joao Miguel Ferreira <joao.miguel.c.ferreira@gmail.com>
  parent: Adrian Klaver <adrian.klaver@aklaver.com>
  0 siblings, 2 replies; 10+ messages in thread

From: Joao Miguel Ferreira @ 2021-10-03 17:15 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: pgsql-general <pgsql-general@lists.postgresql.org>

On Sun, Oct 3, 2021 at 6:03 PM Adrian Klaver <adrian.klaver@aklaver.com>
wrote:

> On 10/3/21 9:56 AM, Joao Miguel Ferreira wrote:
> > Hello all,
> >
> > is there a way to ask pg_dump to save a comment in the output file with
> > the full command it is executing ?
>
> No.
>
> What information is the comment trying to convey?
>

I just wanted to save the command inside the SQL file to be able to
"remember" it later. ideally I would open the file on some text editor and
see the original pg_dump command on the few first lines, as a comment

-- original command was: psql -h some_host -p .....


>
> Are you dumping in plain or custom format?
>

plain (SQL)


>
> >
> > thank you
> > Joao
> >
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
>

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

* Re: pg_dump save command in output
@ 2021-10-03 17:23  Karsten Hilbert <Karsten.Hilbert@gmx.net>
  parent: Joao Miguel Ferreira <joao.miguel.c.ferreira@gmail.com>
  1 sibling, 0 replies; 10+ messages in thread

From: Karsten Hilbert @ 2021-10-03 17:23 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

Am Sun, Oct 03, 2021 at 06:15:54PM +0100 schrieb Joao Miguel Ferreira:

> I just wanted to save the command inside the SQL file to be able to
> "remember" it later. ideally I would open the file on some text editor and
> see the original pg_dump command on the few first lines, as a comment
>
> -- original command was: psql -h some_host -p .....
>
> >
> > Are you dumping in plain or custom format?
> >
>
> plain (SQL)

Run the dump from a bash script which pre-catenates (Is that
even a word ? it is now :) the command into the plain (SQL)
output after the fact.

Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B





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

* Re: pg_dump save command in output
@ 2021-10-03 17:23  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Joao Miguel Ferreira <joao.miguel.c.ferreira@gmail.com>
  1 sibling, 0 replies; 10+ messages in thread

From: Adrian Klaver @ 2021-10-03 17:23 UTC (permalink / raw)
  To: Joao Miguel Ferreira <joao.miguel.c.ferreira@gmail.com>; +Cc: pgsql-general <pgsql-general@lists.postgresql.org>

On 10/3/21 10:15 AM, Joao Miguel Ferreira wrote:
> 

> I just wanted to save the command inside the SQL file to be able to 
> "remember" it later. ideally I would open the file on some text editor 
> and see the original pg_dump command on the few first lines, as a comment
> 
> -- original command was: psql -h some_host -p .....
> 
> 
>     Are you dumping in plain or custom format?
> 
> 
> plain (SQL)

A quick test here found that manually adding:

-- original command was: psql -h some_host -p .....

as:

-- Dumped by pg_dump version XX.x
-- original command was: psql -h some_host -p .....

at head of file did not infer with the restore.

No guarantees though.


> 
> 
>      >
>      > thank you
>      > Joao
>      >
> 
> 
>     -- 
>     Adrian Klaver
>     adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





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

* Re: pg_dump save command in output
@ 2021-10-06 09:33  Daniel Gustafsson <daniel@yesql.se>
  parent: Joao Miguel Ferreira <joao.miguel.c.ferreira@gmail.com>
  1 sibling, 1 reply; 10+ messages in thread

From: Daniel Gustafsson @ 2021-10-06 09:33 UTC (permalink / raw)
  To: Joao Miguel Ferreira <joao.miguel.c.ferreira@gmail.com>; +Cc: pgsql-general <pgsql-general@lists.postgresql.org>

> On 3 Oct 2021, at 18:56, Joao Miguel Ferreira <joao.miguel.c.ferreira@gmail.com> wrote:

> is there a way to ask pg_dump to save a comment in the output file with the full command it is executing ?

I think this idea has some merit.  Given the amount of switches for tailoring
the dump that pg_dump has there is a point to knowing just which ones were
used.  Connection level parameters should probably be scrubbed, but
object-level filtering etc could be handy.

Would you like to try and propose a patch for pg_dump to implement this?

--
Daniel Gustafsson		https://vmware.com/






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

* Re: pg_dump save command in output
@ 2021-10-06 09:44  Joao Miguel Ferreira <joao.miguel.c.ferreira@gmail.com>
  parent: Daniel Gustafsson <daniel@yesql.se>
  0 siblings, 1 reply; 10+ messages in thread

From: Joao Miguel Ferreira @ 2021-10-06 09:44 UTC (permalink / raw)
  To: daniel@yesql.se; +Cc: pgsql-general <pgsql-general@lists.postgresql.org>

On Wed, Oct 6, 2021 at 10:33 AM Daniel Gustafsson <daniel@yesql.se> wrote:

> > On 3 Oct 2021, at 18:56, Joao Miguel Ferreira <
> joao.miguel.c.ferreira@gmail.com> wrote:
>
> > is there a way to ask pg_dump to save a comment in the output file with
> the full command it is executing ?
>
> I think this idea has some merit.  Given the amount of switches for
> tailoring
> the dump that pg_dump has there is a point to knowing just which ones were
> used.  Connection level parameters should probably be scrubbed, but
> object-level filtering etc could be handy.
>
> Would you like to try and propose a patch for pg_dump to implement this?
>
Hi Daniel, thank you for the feedback!

I would like to try that yes, it would be a pleasure but I have zero
knowledge on the dev tools, setups and processes required for that.

If someone gives me some pointers I would love to try it. I'm a software
developer so I should be able to at least try.

Can you point me to some hands-on docs on setting up my env ?

I use Debian Linux 10 and 11 VMs, if that is relevant, I could copy a VM
for this purpose and start right away

Thank you
Joao (pg user for many many years)






>
> --
> Daniel Gustafsson               https://vmware.com/
>
>

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

* Re: pg_dump save command in output
@ 2021-10-06 10:22  Laurenz Albe <laurenz.albe@cybertec.at>
  parent: Joao Miguel Ferreira <joao.miguel.c.ferreira@gmail.com>
  0 siblings, 1 reply; 10+ messages in thread

From: Laurenz Albe @ 2021-10-06 10:22 UTC (permalink / raw)
  To: Joao Miguel Ferreira <joao.miguel.c.ferreira@gmail.com>; daniel@yesql.se; +Cc: pgsql-general <pgsql-general@lists.postgresql.org>

On Wed, 2021-10-06 at 10:44 +0100, Joao Miguel Ferreira wrote:
> I would like to try that yes, it would be a pleasure but I have zero knowledge on the dev tools, setups and processes required for that. 
> 
> If someone gives me some pointers I would love to try it. I'm a software developer so I should be able to at least try.
> 
> Can you point me to some hands-on docs on setting up my env ?

Here is an introductory article from the Wiki:

https://wiki.postgresql.org/wiki/So,_you_want_to_be_a_developer%3F

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com






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

* Re: pg_dump save command in output
@ 2021-10-06 10:40  Daniel Gustafsson <daniel@yesql.se>
  parent: Laurenz Albe <laurenz.albe@cybertec.at>
  0 siblings, 1 reply; 10+ messages in thread

From: Daniel Gustafsson @ 2021-10-06 10:40 UTC (permalink / raw)
  To: Laurenz Albe <laurenz.albe@cybertec.at>; +Cc: Joao Miguel Ferreira <joao.miguel.c.ferreira@gmail.com>; pgsql-general <pgsql-general@lists.postgresql.org>

> On 6 Oct 2021, at 12:22, Laurenz Albe <laurenz.albe@cybertec.at> wrote:
> 
> On Wed, 2021-10-06 at 10:44 +0100, Joao Miguel Ferreira wrote:
>> I would like to try that yes, it would be a pleasure but I have zero knowledge on the dev tools, setups and processes required for that. 
>> 
>> If someone gives me some pointers I would love to try it. I'm a software developer so I should be able to at least try.
>> 
>> Can you point me to some hands-on docs on setting up my env ?
> 
> Here is an introductory article from the Wiki:
> 
> https://wiki.postgresql.org/wiki/So,_you_want_to_be_a_developer%3F

There is also the section in the docs for how to install a postgres instance
for source which will be handy:

    https://www.postgresql.org/docs/devel/installation.html

For an environment to hack in I would recommend enabling debig and TAP style
tests, and personally I always install to a specific folder (see the section on
developer options):

    ./configure --enable-debug --enable-tap-tests --prefix=path/to/dev/install

Feel free to reach out here if you get stuck on anything, so we can make the
Wiki page better.

--
Daniel Gustafsson		https://vmware.com/






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

* Re: pg_dump save command in output
@ 2021-10-06 11:56  Joao Miguel Ferreira <joao.miguel.c.ferreira@gmail.com>
  parent: Daniel Gustafsson <daniel@yesql.se>
  0 siblings, 0 replies; 10+ messages in thread

From: Joao Miguel Ferreira @ 2021-10-06 11:56 UTC (permalink / raw)
  To: Daniel Gustafsson <daniel@yesql.se>; +Cc: Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-general <pgsql-general@lists.postgresql.org>

On Wed, Oct 6, 2021 at 11:40 AM Daniel Gustafsson <daniel@yesql.se> wrote:

> > On 6 Oct 2021, at 12:22, Laurenz Albe <laurenz.albe@cybertec.at> wrote:
> >
> > On Wed, 2021-10-06 at 10:44 +0100, Joao Miguel Ferreira wrote:
> >> I would like to try that yes, it would be a pleasure but I have zero
> knowledge on the dev tools, setups and processes required for that.
> >>
> >> If someone gives me some pointers I would love to try it. I'm a
> software developer so I should be able to at least try.
> >>
> >> Can you point me to some hands-on docs on setting up my env ?
> >
> > Here is an introductory article from the Wiki:
> >
> > https://wiki.postgresql.org/wiki/So,_you_want_to_be_a_developer%3F
>
> There is also the section in the docs for how to install a postgres
> instance
> for source which will be handy:
>
>     https://www.postgresql.org/docs/devel/installation.html
>
> For an environment to hack in I would recommend enabling debig and TAP
> style
> tests, and personally I always install to a specific folder (see the
> section on
> developer options):
>
>     ./configure --enable-debug --enable-tap-tests
> --prefix=path/to/dev/install
>

Hi again, thank you both for the guidance. I will start reading and setting
things up in the next few days


>
> Feel free to reach out here if you get stuck on anything, so we can make
> the
> Wiki page better.
>

sure


>
> --
> Daniel Gustafsson               https://vmware.com/
>
>

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


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

Thread overview: 10+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-10-03 16:56 pg_dump save command in output Joao Miguel Ferreira <joao.miguel.c.ferreira@gmail.com>
2021-10-03 17:03 ` Adrian Klaver <adrian.klaver@aklaver.com>
2021-10-03 17:15   ` Joao Miguel Ferreira <joao.miguel.c.ferreira@gmail.com>
2021-10-03 17:23     ` Karsten Hilbert <Karsten.Hilbert@gmx.net>
2021-10-03 17:23     ` Adrian Klaver <adrian.klaver@aklaver.com>
2021-10-06 09:33 ` Daniel Gustafsson <daniel@yesql.se>
2021-10-06 09:44   ` Joao Miguel Ferreira <joao.miguel.c.ferreira@gmail.com>
2021-10-06 10:22     ` Laurenz Albe <laurenz.albe@cybertec.at>
2021-10-06 10:40       ` Daniel Gustafsson <daniel@yesql.se>
2021-10-06 11:56         ` Joao Miguel Ferreira <joao.miguel.c.ferreira@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