Get the App
SLTechnology News&Howtos  ›  Database  › 

PostgreSQL DBA (137)-PG 13 (Allow invisible PROMPT2 in psql)

Shulou Source: shulou.com Published: 2022-06-01 05:28:12 11月14日 Update

In PG 12 or below, psql distinguishes the same command with line breaks by configuring PROMPT2, and in PG 13, all lines of SQL can be aligned to the left by setting% w.

PG 12

[local:/data/pg12]: 5432 pg12@testdb=#\! Cat .psqlrc\ set PROMPT1'% n@%/%R%#%x% >% n@%/%R%#%x'\ set PROMPT2'% n@%/%R%#%x'\ x auto [local:/data/pg12]: 5432 pg12@testdb=# select pg12@testdb-# 1 + 1;? column?-2 (1 row)

PG 13

[local]: 5130 pg13@masterdb=# select version () Version -- PostgreSQL 13devel on x86_64-pc-linux-gnu Compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16), 64-bit (1 row) [local]: 5130 pg13@masterdb=#\! Cat .psqlrc\ set PROMPT1'% n@%/%R%#%x% >% n@%/%R%#%x'\ set PROMPT2'% n@%/%R%#%x'\ x auto [local]: 5130 pg13@masterdb=# [local]: 5130 pg13@masterdb=#\ set PROMPT2'% w' [local]: 5130 pg13@masterdb=# select 1 + 1;? column?-2 (1 row) [local]: 5130 pg13@masterdb=#

references

Waiting for PostgreSQL 13-Allow invisible PROMPT2 in psql.

Tags: References commands situations versions materials references configurations Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Microsoft NVidia Linux Apple