Re: Logical Replication Delay

2024-09-23 Thread Justin
Hi Ramakrishna, I am not following the reasoning on not separating the tables into different publications and subscriptions. I set up logical replication all the time in many different environments, one of the audits I perform before deploying LR is looking at pg_stat_all_tables and WAL creation

Re: Customize psql prompt to show current_role

2024-09-23 Thread Tom Lane
Adrian Klaver writes: > On 9/23/24 08:07, Dominique Devienne wrote: >> I often resort to \conninfo, but it's less automatic and >> harder to visually parse (IMHO) compared to a custom ad-hoc prompt. > For me that shows the user that connected(session_user) not the > current_user. Worse than tha

Re: Customize psql prompt to show current_role

2024-09-23 Thread Dominique Devienne
On Mon, Sep 23, 2024 at 5:16 PM Adrian Klaver wrote: > On 9/23/24 08:07, Dominique Devienne wrote: > > I often resort to \conninfo, but it's less automatic and > > harder to visually parse (IMHO) compared to a custom ad-hoc prompt. > For me that shows the user that connected(session_user) not the

Re: Customize psql prompt to show current_role

2024-09-23 Thread Adrian Klaver
On 9/23/24 08:07, Dominique Devienne wrote: On Mon, Sep 23, 2024 at 4:55 PM Tom Lane wrote: Laurenz Albe writes: To get the current role, psql would have to query the database whenever it displays the prompt. That would be rather expensive... See previous discussion: https://www.postgresql

Re: Customize psql prompt to show current_role

2024-09-23 Thread Dominique Devienne
On Mon, Sep 23, 2024 at 4:55 PM Tom Lane wrote: > Laurenz Albe writes: > > To get the current role, psql would have to query the database whenever > > it displays the prompt. That would be rather expensive... > > See previous discussion: > https://www.postgresql.org/message-id/flat/CAFj8pRBFU-Wz

Re: Customize psql prompt to show current_role

2024-09-23 Thread Tom Lane
Laurenz Albe writes: > To get the current role, psql would have to query the database whenever > it displays the prompt. That would be rather expensive... See previous discussion: https://www.postgresql.org/message-id/flat/CAFj8pRBFU-WzzQhNrwRHn67N0Ug8a9-0-9BOo69PPtcHiBDQMA%40mail.gmail.com At

Re: Customize psql prompt to show current_role

2024-09-23 Thread Dominique Devienne
On Mon, Sep 23, 2024 at 3:05 PM Laurenz Albe wrote: > On Mon, 2024-09-23 at 14:59 +0200, Dominique Devienne wrote: > > On Mon, Sep 23, 2024 at 2:51 PM Erik Wienhold wrote: > > > You could instead use this: > > > > > > SELECT current_role \gset > > > \set PROMPT1 '%n@%/ (%:current_role:)=%

Re: Customize psql prompt to show current_role

2024-09-23 Thread Laurenz Albe
On Mon, 2024-09-23 at 14:59 +0200, Dominique Devienne wrote: > On Mon, Sep 23, 2024 at 2:51 PM Erik Wienhold wrote: > > You could instead use this: > > > > SELECT current_role \gset > > \set PROMPT1 '%n@%/ (%:current_role:)=%# ' > > > > But that won't work with subsequent SET ROLE comman

Re: Customize psql prompt to show current_role

2024-09-23 Thread Greg Sabino Mullane
On Mon, Sep 23, 2024 at 8:22 AM Asad Ali wrote: > There is no direct prompt escape sequence like %n for displaying the > current_role in the psql prompt. However, you can work around this by using > a \set command to define a custom prompt that includes the result of > current_role. > Please do

Re: Customize psql prompt to show current_role

2024-09-23 Thread Dominique Devienne
On Mon, Sep 23, 2024 at 2:51 PM Erik Wienhold wrote: > You could instead use this: > > SELECT current_role \gset > \set PROMPT1 '%n@%/ (%:current_role:)=%# ' > > But that won't work with subsequent SET ROLE commands. Bummer... That was kinda the point, that it updates automatically. Then

Re: Why no pg_has_role(..., 'ADMIN')?

2024-09-23 Thread Dominique Devienne
On Fri, Sep 20, 2024 at 8:49 PM Robert Haas wrote: > On Fri, Sep 20, 2024 at 2:34 PM Tom Lane wrote: > > I'm now inclined to add wording within the pg_has_role entry > I don't have an opinion about the details, but +1 for documenting it +1 as well. Especially since I now recall, in hindsight, ab

Re: Why no pg_has_role(..., 'ADMIN')?

2024-09-23 Thread Dominique Devienne
On Fri, Sep 20, 2024 at 6:51 PM Robert Haas wrote: > On Fri, Sep 20, 2024 at 12:37 PM Laurenz Albe > wrote: > > That would be a useful addition, yes. > > I think this already exists. The full list of modes supported by > pg_has_role() is listed in convert_role_priv_string(). You can do > somethi

Re: Customize psql prompt to show current_role

2024-09-23 Thread Erik Wienhold
On 2024-09-23 14:22 +0200, Asad Ali wrote: > There is no direct prompt escape sequence like %n for displaying the > current_role in the psql prompt. However, you can work around this by using > a \set command to define a custom prompt that includes the result of > current_role. > You can use the fo

Re: Customize psql prompt to show current_role

2024-09-23 Thread gparc
- Mail original - > De: "Dominique Devienne" > À: "Asad Ali" > Cc: pgsql-gene...@postgresql.org > Envoyé: Lundi 23 Septembre 2024 14:34:39 > Objet: Re: Customize psql prompt to show current_role > On Mon, Sep 23, 2024 at 2:22 PM Asad Ali wrote: >> There is no direct prompt escape sequen

Re: Customize psql prompt to show current_role

2024-09-23 Thread Dominique Devienne
On Mon, Sep 23, 2024 at 2:22 PM Asad Ali wrote: > There is no direct prompt escape sequence like %n for displaying the > current_role in the psql prompt. > However, you can work around this by using a \set command to define a custom > prompt that includes the result of current_role. Hi Ali. Doe

Re: Customize psql prompt to show current_role

2024-09-23 Thread Asad Ali
Hi Dominique, There is no direct prompt escape sequence like %n for displaying the current_role in the psql prompt. However, you can work around this by using a \set command to define a custom prompt that includes the result of current_role. You can use the following command to set your psql PROMP

Customize psql prompt to show current_role

2024-09-23 Thread Dominique Devienne
Hi. I've successfully customized my psql PROMPT1, using %n for session_user, but I'd like to see current_role as well. And I can't seem to find a way. I didn't find a direct \x for it. I didn't find a %'X' variable for it. I didn't find a command to %`X` either. (and X = `select current_role` does