public inbox for [email protected]  
help / color / mirror / Atom feed
[PATCH 08/10] Default to zstd..
3+ messages / 3 participants
[nested] [flat]

* [PATCH 08/10] Default to zstd..
@ 2021-03-12 21:35 Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Justin Pryzby @ 2021-03-12 21:35 UTC (permalink / raw)

for CI, not for merge
---
 configure                         | 6 ++++--
 configure.ac                      | 2 +-
 src/backend/access/transam/xlog.c | 2 +-
 src/backend/utils/misc/guc.c      | 2 +-
 4 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index 81e23418b2..253f028fc4 100755
--- a/configure
+++ b/configure
@@ -1582,7 +1582,7 @@ Optional Packages:
                           use system time zone data in DIR
   --without-zlib          do not use Zlib
   --without-lz4           build without LZ4 support
-  --with-zstd             build with Zstd compression library
+  --without-zstd          build without Zstd compression library
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
   --with-ssl=LIB          use LIB for SSL/TLS support (openssl)
   --with-openssl          obsolete spelling of --with-ssl=openssl
@@ -8740,7 +8740,9 @@ $as_echo "#define USE_ZSTD 1" >>confdefs.h
   esac
 
 else
-  with_zstd=no
+  with_zstd=yes
+
+$as_echo "#define USE_ZSTD 1" >>confdefs.h
 
 fi
 
diff --git a/configure.ac b/configure.ac
index d6f6349067..8d72710fa7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1005,7 +1005,7 @@ fi
 # ZSTD
 #
 AC_MSG_CHECKING([whether to build with zstd support])
-PGAC_ARG_BOOL(with, zstd, no, [build with Zstd compression library],
+PGAC_ARG_BOOL(with, zstd, yes, [build without Zstd compression library],
               [AC_DEFINE([USE_ZSTD], 1, [Define to 1 to build with zstd support. (--with-zstd)])])
 AC_MSG_RESULT([$with_zstd])
 AC_SUBST(with_zstd)
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 307eee6626..92023de9f5 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -99,7 +99,7 @@ bool		EnableHotStandby = false;
 bool		fullPageWrites = true;
 bool		wal_log_hints = false;
 bool		wal_compression = false;
-int			wal_compression_method = WAL_COMPRESSION_LZ4;
+int			wal_compression_method = WAL_COMPRESSION_ZSTD;
 char	   *wal_consistency_checking_string = NULL;
 bool	   *wal_consistency_checking = NULL;
 bool		wal_init_zero = true;
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 52f9cd0242..8031e027aa 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -4728,7 +4728,7 @@ static struct config_enum ConfigureNamesEnum[] =
 			NULL
 		},
 		&wal_compression_method,
-		WAL_COMPRESSION_LZ4, wal_compression_options,
+		WAL_COMPRESSION_ZSTD, wal_compression_options,
 		NULL, NULL, NULL
 	},
 
-- 
2.17.0


--XsQoSWH+UP9D9v3l
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
 filename="0009-Add-zstd-compression-levels.patch"



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* psql: make %P prompt option consistent when not connected
@ 2026-01-28 08:38 Chao Li <[email protected]>
  2026-01-29 00:32 ` Re: psql: make %P prompt option consistent when not connected Michael Paquier <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Chao Li @ 2026-01-28 08:38 UTC (permalink / raw)
  To: PostgreSQL Hackers <[email protected]>

Hi Hackers,

While reviewing and testing patch [1], I noticed that psql’s %P prompt option does not check pset.db, which makes it inconsistent with other prompt options. As a result, when there is no database connection, other prompt elements are suppressed, but the pipeline status is still shown. For example:

```
evantest=# \set PROMPT1 '[%P] %R '
[off] = \c
connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory
	Is the server running locally and accepting connections on that socket?
Previous connection kept
[off] = ;
FATAL:  terminating connection due to administrator command
server closed the connection unexpectedly
	This probably means the server terminated abnormally
	before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
The connection to the server was lost. Attempting reset: Failed.
[off] !
[off] !
```

To confirm whether this behavior is intentional, I went through the original discussion for adding %P [2], but didn’t find this case mentioned, so it seems this detail was simply not considered at the time.

This patch adds a pset.db check to align %P with the other prompt options, keeping the prompt display consistent when not connected. With the patch applied, all psql TAP tests pass:
```
# +++ tap check in src/bin/psql +++
t/001_basic.pl ........... ok
t/010_tab_completion.pl .. ok
t/020_cancel.pl .......... ok
t/030_pager.pl ........... ok
All tests successful.
Files=4, Tests=221,  5 wallclock secs ( 0.01 usr  0.01 sys +  1.05 cusr  1.38 csys =  2.45 CPU)
Result: PASS
```
[1] https://www.postgresql.org/message-id/flat/[email protected]
[2] https://www.postgresql.org/message-id/[email protected]...

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/






Attachments:

  [application/octet-stream] v1-0001-psql-make-P-prompt-escape-consistent-when-not-con.patch (1.3K, ../../[email protected]/2-v1-0001-psql-make-P-prompt-escape-consistent-when-not-con.patch)
  download | inline diff:
From 0fa5336d5da7ec7ff2b0dd087a3aac6644979ab9 Mon Sep 17 00:00:00 2001
From: "Chao Li (Evan)" <[email protected]>
Date: Wed, 28 Jan 2026 16:19:47 +0800
Subject: [PATCH v1] psql: make %P prompt escape consistent when not connected

The %P prompt escape shows the current pipeline status.  Unlike most
other prompt escapes, it was evaluated even when psql was not connected
to a database.

Make %P behave consistently with the other prompt options by only
expanding it when a database connection exists.  This keeps the prompt
display consistent in the not-connected state.

Author: Chao Li <[email protected]>
Reviewed-by:
Discussion:
---
 src/bin/psql/prompt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/bin/psql/prompt.c b/src/bin/psql/prompt.c
index 44eae59641e..891cd6374f0 100644
--- a/src/bin/psql/prompt.c
+++ b/src/bin/psql/prompt.c
@@ -199,6 +199,7 @@ get_prompt(promptStatus_t status, ConditionalStack cstack)
 					break;
 					/* pipeline status */
 				case 'P':
+					if (pset.db)
 					{
 						PGpipelineStatus status = PQpipelineStatus(pset.db);
 
@@ -208,9 +209,8 @@ get_prompt(promptStatus_t status, ConditionalStack cstack)
 							strlcpy(buf, "abort", sizeof(buf));
 						else
 							strlcpy(buf, "off", sizeof(buf));
-						break;
 					}
-
+					break;
 				case '0':
 				case '1':
 				case '2':
-- 
2.50.1 (Apple Git-155)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: psql: make %P prompt option consistent when not connected
  2026-01-28 08:38 psql: make %P prompt option consistent when not connected Chao Li <[email protected]>
@ 2026-01-29 00:32 ` Michael Paquier <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Michael Paquier @ 2026-01-29 00:32 UTC (permalink / raw)
  To: Chao Li <[email protected]>; +Cc: PostgreSQL Hackers <[email protected]>

On Wed, Jan 28, 2026 at 04:38:08PM +0800, Chao Li wrote:
> While reviewing and testing patch [1], I noticed that psql’s %P
> prompt option does not check pset.db, which makes it inconsistent
> with other prompt options. As a result, when there is no database
> connection, other prompt elements are suppressed, but the pipeline
> status is still shown.

Point taken.  It's true that it is confusing to show an "off" status
in this case if we don't have an active connection.  Will adjust and
backpatch.
--
Michael


Attachments:

  [application/pgp-signature] signature.asc (833B, ../../[email protected]/2-signature.asc)
  download

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2026-01-29 00:32 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-03-12 21:35 [PATCH 08/10] Default to zstd.. Justin Pryzby <[email protected]>
2026-01-28 08:38 psql: make %P prompt option consistent when not connected Chao Li <[email protected]>
2026-01-29 00:32 ` Re: psql: make %P prompt option consistent when not connected Michael Paquier <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox