psql meta command

Started by Marc Millas12 months ago4 messagesgeneral
Jump to latest
#1Marc Millas
marc.millas@mokadb.com

Hello,

on a customer postgres db, using psql, if I post \ to initiate, for
exemple \x
that psql immediately exits.
somewhat boring as it blocks all psql meta commands.
Is there a way to get the extended display without posting a \ ?

thanks,

Marc MILLAS
Senior Architect
+33607850334
www.mokadb.com

#2Laurenz Albe
laurenz.albe@cybertec.at
In reply to: Marc Millas (#1)
Re: psql meta command

On Thu, 2025-04-10 at 14:29 +0200, Marc Millas wrote:

on a customer postgres db, using psql, if I post \  to initiate, for exemple \x
that psql immediately exits.
somewhat boring as it blocks all psql meta commands.
Is there a way to get the extended display without posting a \  ?

Odd. No, I don't think there is a workaround.

Are you remote controlling the machine? Which operating system?
I'd guess the problem is not withing psql.

Yours,
Laurenz Albe

#3Pavel Luzanov
p.luzanov@postgrespro.ru
In reply to: Marc Millas (#1)
Re: psql meta command

On 10.04.2025 15:29, Marc Millas wrote:

on a customer postgres db, using psql, if I post \  to initiate, for
exemple \x
that psql immediately exits.
somewhat boring as it blocks all psql meta commands.
Is there a way to get the extended display without posting a \  ?

You can enable extended output when starting psql:

$ psql -x -c 'select 1,2,3'
-[ RECORD 1 ]
?column? | 1
?column? | 2
?column? | 3

Also, not sure but you can try hide \ in psql variable:

$ psql --set expanded_mode='\x'
psql (18devel)
Type "help" for help.

postgres@demo(18.0)=# :expanded_mode
Expanded display is on.
postgres@demo(18.0)=# select 1,2,3;
-[ RECORD 1 ]
?column? | 1
?column? | 2
?column? | 3

--
Pavel Luzanov
Postgres Professional:https://postgrespro.com

#4Christoph Moench-Tegeder
cmt@burggraben.net
In reply to: Marc Millas (#1)
Re: psql meta command

## Marc Millas (marc.millas@mokadb.com):

on a customer postgres db, using psql, if I post \ to initiate, for
exemple \x
that psql immediately exits.

I've seen that happen with broken terminals, mostly some "web shell"
stuff. Ditch that, it's most likely broken in other ways, too.

somewhat boring as it blocks all psql meta commands.
Is there a way to get the extended display without posting a \ ?

If you can live with expanded mode being constantly on, start psql
with parameter -x as in "--expanded".

Regards,
Christoph

--
Spare Space