Search Postgresql Archives

Re: Customize psql prompt to show current_role

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 23, 2024 at 2:22 PM Asad Ali <asadalinagri@xxxxxxxxx> 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. Doesn't seem to be working for me. Did I do something wrong? --DD

```
D:\>psql service=pau16
psql (17beta3, server 16.1)
Type "help" for help.

ddevienne=> \set current_role 'SELECT current_role;'
ddevienne=> \set PROMPT1 '%n@%/ (%`current_role`)=%# '
'current_role' is not recognized as an internal or external command,
operable program or batch file.
ddevienne@ddevienne ()=> select 1;
...
'current_role' is not recognized as an internal or external command,
operable program or batch file.
ddevienne@ddevienne ()=>
```






[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux