Thread: psql meta command

psql meta command

From
Marc Millas
Date:
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

Re: psql meta command

From
Laurenz Albe
Date:
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



Re: psql meta command

From
Pavel Luzanov
Date:
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

Re: psql meta command

From
Christoph Moench-Tegeder
Date:
## 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