$user namespace with pg_dump?

From: "Mark E(dot) Haase" <mehaase(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: $user namespace with pg_dump?
Date: 2016-03-02 17:06:45
Message-ID: CALb0Rk5dtnMjWfKB+h9bLeezi3A62n6SnBwDGAwiCD-8JzMObg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I can `SET search_path TO "$user",foo,bar,public` and the first path
element will expand to the current user.

Can I do the same for `pg_dump -n`? I've tried many variations but none of
them appear to work:

pg_dump -U myuser -n '($user|foo|bar|public)' ...
pg_dump -U myuser -n '("$user"|foo|bar|public)' ...
pg_dump -U myuser -n '(\$user|foo|bar|public)' ...

I can't tell if I'm doing something wrong or if $user expansion is just
some magic in SET that doesn't exist in pg_dump or `\dn`.

(The workaround is obvious, of course: replace $user with the value of the
-U argument . This is a question of curiosity, not practicality.)

Also, is there any difference between `pg_dump -n '(foo|bar)'` and `pg_dump
-n foo -n bar`? In my narrow testing, they produce identical results.

Thanks,

--
Mark E. Haase

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alexander Farber 2016-03-02 18:31:11 Re: How to ensure that a stored function always returns TRUE or FALSE?
Previous Message Rémi Cura 2016-03-02 16:49:12 Re: bloated postgres data folder, clean up