[PATCH] postgresql.conf.sample comment alignment.

Started by Peter Smithover 3 years ago9 messages
#1Peter Smith
smithpb2250@gmail.com
1 attachment(s)

This patch tweaks a some tabbing and replaces some spaces with tabs to
improve slightly the comment alignment in file
'postgresql.conf.sample'

PSA.

------
Kind Regards,
Peter Smith.
Fujitsu Australia

Attachments:

v1-0001-Align-the-comments.patchapplication/octet-stream; name=v1-0001-Align-the-comments.patchDownload
From d90b6f327a246d3ed4adf56720350a0e386e9d8a Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Mon, 1 Aug 2022 17:19:22 +1000
Subject: [PATCH v1] Align the comments.

---
 src/backend/utils/misc/postgresql.conf.sample | 42 +++++++++++++--------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index b4bc06e..141c6cf 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -108,7 +108,7 @@
 #ssl_crl_file = ''
 #ssl_crl_dir = ''
 #ssl_key_file = 'server.key'
-#ssl_ciphers = 'HIGH:MEDIUM:+3DES:!aNULL' # allowed SSL ciphers
+#ssl_ciphers = 'HIGH:MEDIUM:+3DES:!aNULL'	# allowed SSL ciphers
 #ssl_prefer_server_ciphers = on
 #ssl_ecdh_curve = 'prime256v1'
 #ssl_min_protocol_version = 'TLSv1.2'
@@ -243,9 +243,9 @@
 
 # - Prefetching during recovery -
 
-#recovery_prefetch = try		# prefetch pages referenced in the WAL?
-#wal_decode_buffer_size = 512kB		# lookahead window used for prefetching
-					# (change requires restart)
+#recovery_prefetch = try	# prefetch pages referenced in the WAL?
+#wal_decode_buffer_size = 512kB	# lookahead window used for prefetching
+				# (change requires restart)
 
 # - Archiving -
 
@@ -277,7 +277,7 @@
 # Set these only when performing a targeted recovery.
 
 #recovery_target = ''		# 'immediate' to end recovery as soon as a
-                                # consistent state is reached
+				# consistent state is reached
 				# (change requires restart)
 #recovery_target_name = ''	# the named restore point to which recovery will proceed
 				# (change requires restart)
@@ -287,14 +287,14 @@
 				# (change requires restart)
 #recovery_target_lsn = ''	# the WAL LSN up to which recovery will proceed
 				# (change requires restart)
-#recovery_target_inclusive = on # Specifies whether to stop:
+#recovery_target_inclusive = on	# Specifies whether to stop:
 				# just after the specified recovery target (on)
 				# just before the recovery target (off)
 				# (change requires restart)
 #recovery_target_timeline = 'latest'	# 'current', 'latest', or timeline ID
-				# (change requires restart)
+					# (change requires restart)
 #recovery_target_action = 'pause'	# 'pause', 'promote', 'shutdown'
-				# (change requires restart)
+					# (change requires restart)
 
 
 #------------------------------------------------------------------------------
@@ -397,7 +397,7 @@
 #cpu_tuple_cost = 0.01			# same scale as above
 #cpu_index_tuple_cost = 0.005		# same scale as above
 #cpu_operator_cost = 0.0025		# same scale as above
-#parallel_setup_cost = 1000.0	# same scale as above
+#parallel_setup_cost = 1000.0		# same scale as above
 #parallel_tuple_cost = 0.1		# same scale as above
 #min_parallel_table_scan_size = 8MB
 #min_parallel_index_scan_size = 512kB
@@ -458,7 +458,7 @@
 #log_directory = 'log'			# directory where log files are written,
 					# can be absolute or relative to PGDATA
 #log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'	# log file name pattern,
-					# can include strftime() escapes
+							# can include strftime() escapes
 #log_file_mode = 0600			# creation mode for log files,
 					# begin with 0 to use octal notation
 #log_rotation_age = 1d			# Automatic rotation of logfiles will
@@ -643,19 +643,19 @@
 #autovacuum_vacuum_threshold = 50	# min number of row updates before
 					# vacuum
 #autovacuum_vacuum_insert_threshold = 1000	# min number of row inserts
-					# before vacuum; -1 disables insert
-					# vacuums
+						# before vacuum; -1 disables insert
+						# vacuums
 #autovacuum_analyze_threshold = 50	# min number of row updates before
 					# analyze
 #autovacuum_vacuum_scale_factor = 0.2	# fraction of table size before vacuum
 #autovacuum_vacuum_insert_scale_factor = 0.2	# fraction of inserts over table
-					# size before insert vacuum
+						# size before insert vacuum
 #autovacuum_analyze_scale_factor = 0.1	# fraction of table size before analyze
 #autovacuum_freeze_max_age = 200000000	# maximum XID age before forced vacuum
 					# (change requires restart)
 #autovacuum_multixact_freeze_max_age = 400000000	# maximum multixact age
-					# before forced vacuum
-					# (change requires restart)
+							# before forced vacuum
+							# (change requires restart)
 #autovacuum_vacuum_cost_delay = 2ms	# default vacuum cost delay for
 					# autovacuum, in milliseconds;
 					# -1 means use vacuum_cost_delay
@@ -692,10 +692,10 @@
 #default_transaction_read_only = off
 #default_transaction_deferrable = off
 #session_replication_role = 'origin'
-#statement_timeout = 0			# in milliseconds, 0 is disabled
-#lock_timeout = 0			# in milliseconds, 0 is disabled
+#statement_timeout = 0				# in milliseconds, 0 is disabled
+#lock_timeout = 0				# in milliseconds, 0 is disabled
 #idle_in_transaction_session_timeout = 0	# in milliseconds, 0 is disabled
-#idle_session_timeout = 0		# in milliseconds, 0 is disabled
+#idle_session_timeout = 0			# in milliseconds, 0 is disabled
 #vacuum_freeze_table_age = 150000000
 #vacuum_freeze_min_age = 50000000
 #vacuum_failsafe_age = 1600000000
@@ -712,7 +712,7 @@
 #datestyle = 'iso, mdy'
 #intervalstyle = 'postgres'
 #timezone = 'GMT'
-#timezone_abbreviations = 'Default'     # Select the set of available time zone
+#timezone_abbreviations = 'Default'	# Select the set of available time zone
 					# abbreviations.  Currently, there are
 					#   Default
 					#   Australia (historical usage)
@@ -738,7 +738,7 @@
 
 #local_preload_libraries = ''
 #session_preload_libraries = ''
-#shared_preload_libraries = ''	# (change requires restart)
+#shared_preload_libraries = ''		# (change requires restart)
 #jit_provider = 'llvmjit'		# JIT library to use
 
 # - Other Defaults -
@@ -759,7 +759,7 @@
 #max_pred_locks_per_relation = -2	# negative values mean
 					# (max_pred_locks_per_transaction
 					#  / -max_pred_locks_per_relation) - 1
-#max_pred_locks_per_page = 2            # min 0
+#max_pred_locks_per_page = 2		# min 0
 
 
 #------------------------------------------------------------------------------
-- 
1.8.3.1

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Smith (#1)
Re: [PATCH] postgresql.conf.sample comment alignment.

Peter Smith <smithpb2250@gmail.com> writes:

This patch tweaks a some tabbing and replaces some spaces with tabs to
improve slightly the comment alignment in file
'postgresql.conf.sample'

Hmm ... the parts you want to change generally look OK to me.
I wonder if you are looking at it with tab stops set to 4 spaces
rather than 8 spaces?

While 4 spaces is our convention for C code, postgresql.conf
is going to be edited by end users who almost certainly have their
editors set up for 8 spaces, so it's going to look funny to them
if the comments are aligned on the assumption of 4 spaces.

One idea for avoiding confusion is to legislate that we won't
use tabs at all in this file (which we could enforce via
.gitattributes, I think). But that might just be making things
equally inconvenient for everybody.

regards, tom lane

#3Peter Smith
smithpb2250@gmail.com
In reply to: Tom Lane (#2)
Re: [PATCH] postgresql.conf.sample comment alignment.

On Tue, Aug 2, 2022 at 10:03 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:

Peter Smith <smithpb2250@gmail.com> writes:

This patch tweaks a some tabbing and replaces some spaces with tabs to
improve slightly the comment alignment in file
'postgresql.conf.sample'

Hmm ... the parts you want to change generally look OK to me.
I wonder if you are looking at it with tab stops set to 4 spaces
rather than 8 spaces?

No. I did fall into that 4/8 trap originally, but I definitely used
:set tapstop=8 when modifying this file.

While 4 spaces is our convention for C code, postgresql.conf
is going to be edited by end users who almost certainly have their
editors set up for 8 spaces, so it's going to look funny to them
if the comments are aligned on the assumption of 4 spaces.

One idea for avoiding confusion is to legislate that we won't
use tabs at all in this file (which we could enforce via
.gitattributes, I think). But that might just be making things
equally inconvenient for everybody.

------
Kind Regards,
Peter Smith
Fujitsu Australia

#4Alvaro Herrera
alvherre@alvh.no-ip.org
In reply to: Tom Lane (#2)
Re: [PATCH] postgresql.conf.sample comment alignment.

On 2022-Aug-01, Tom Lane wrote:

One idea for avoiding confusion is to legislate that we won't
use tabs at all in this file (which we could enforce via
.gitattributes, I think).

+1.

But that might just be making things equally inconvenient for
everybody.

In this situation, the only disadvantaged users are those using a
non-fixed-width font in their editor, but those are lost souls already.

--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"Having your biases confirmed independently is how scientific progress is
made, and hence made our great society what it is today" (Mary Gardiner)

#5Michael Paquier
michael@paquier.xyz
In reply to: Alvaro Herrera (#4)
Re: [PATCH] postgresql.conf.sample comment alignment.

On Wed, Aug 03, 2022 at 12:58:04PM +0200, Alvaro Herrera wrote:

On 2022-Aug-01, Tom Lane wrote:

One idea for avoiding confusion is to legislate that we won't
use tabs at all in this file (which we could enforce via
.gitattributes, I think).

+1.

That's not the first time this 4- or 8-character tab issue is popping
up around here, so enforcing spaces and having a rule sounds like a
good idea at the end.

But that might just be making things equally inconvenient for
everybody.

In this situation, the only disadvantaged users are those using a
non-fixed-width font in their editor, but those are lost souls already.

Haha.
--
Michael

#6Julien Rouhaud
rjuju123@gmail.com
In reply to: Michael Paquier (#5)
Re: [PATCH] postgresql.conf.sample comment alignment.

On Thu, Aug 04, 2022 at 10:09:27AM +0900, Michael Paquier wrote:

On Wed, Aug 03, 2022 at 12:58:04PM +0200, Alvaro Herrera wrote:

On 2022-Aug-01, Tom Lane wrote:

One idea for avoiding confusion is to legislate that we won't
use tabs at all in this file (which we could enforce via
.gitattributes, I think).

+1.

That's not the first time this 4- or 8-character tab issue is popping
up around here, so enforcing spaces and having a rule sounds like a
good idea at the end.

+1

#7Peter Smith
smithpb2250@gmail.com
In reply to: Michael Paquier (#5)
Re: [PATCH] postgresql.conf.sample comment alignment.

On Thu, Aug 4, 2022 at 11:09 AM Michael Paquier <michael@paquier.xyz> wrote:

On Wed, Aug 03, 2022 at 12:58:04PM +0200, Alvaro Herrera wrote:

On 2022-Aug-01, Tom Lane wrote:

One idea for avoiding confusion is to legislate that we won't
use tabs at all in this file (which we could enforce via
.gitattributes, I think).

+1.

That's not the first time this 4- or 8-character tab issue is popping
up around here, so enforcing spaces and having a rule sounds like a
good idea at the end.

Well, it was only assumed that I had probably confused 4- 8- tabs, but
I don't think I did, so the tabbing issue did not really "pop up"
here.

e.g. you can see some of the existing alignments I'd suggested
modifying here [1]https://github.com/postgres/postgres/blob/master/src/backend/utils/misc/postgresql.conf.sample
- #shared_preload_libraries = '' # (change requires restart)
- #idle_in_transaction_session_timeout = 0 # in milliseconds, 0 is
disable <- (moved comments of the neighbours to keep them all aligned)
- etc.

I'm not saying replacing the tabs with spaces isn't a good idea - I
also agree probably it is, but that's a different problem to the
alignments I was trying to correct with the patch

------
[1]: https://github.com/postgres/postgres/blob/master/src/backend/utils/misc/postgresql.conf.sample

Kind Regards,
Peter Smith.
Fujitsu Australia

#8Bruce Momjian
bruce@momjian.us
In reply to: Peter Smith (#7)
Re: [PATCH] postgresql.conf.sample comment alignment.

On Thu, Aug 4, 2022 at 12:42:38PM +1000, Peter Smith wrote:

On Thu, Aug 4, 2022 at 11:09 AM Michael Paquier <michael@paquier.xyz> wrote:

On Wed, Aug 03, 2022 at 12:58:04PM +0200, Alvaro Herrera wrote:

On 2022-Aug-01, Tom Lane wrote:

One idea for avoiding confusion is to legislate that we won't
use tabs at all in this file (which we could enforce via
.gitattributes, I think).

+1.

That's not the first time this 4- or 8-character tab issue is popping
up around here, so enforcing spaces and having a rule sounds like a
good idea at the end.

Well, it was only assumed that I had probably confused 4- 8- tabs, but
I don't think I did, so the tabbing issue did not really "pop up"
here.

e.g. you can see some of the existing alignments I'd suggested
modifying here [1]
- #shared_preload_libraries = '' # (change requires restart)
- #idle_in_transaction_session_timeout = 0 # in milliseconds, 0 is
disable <- (moved comments of the neighbours to keep them all aligned)
- etc.

I'm not saying replacing the tabs with spaces isn't a good idea - I
also agree probably it is, but that's a different problem to the
alignments I was trying to correct with the patch

Patch applied to master. Perhaps someday we will adjust tabs, but for
now, this is an improvements. I made a few small adjustments myself.

--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com

Only you can decide what is important to you.

#9Peter Smith
smithpb2250@gmail.com
In reply to: Bruce Momjian (#8)
Re: [PATCH] postgresql.conf.sample comment alignment.

On Tue, Oct 31, 2023 at 11:51 PM Bruce Momjian <bruce@momjian.us> wrote:

...

Patch applied to master. Perhaps someday we will adjust tabs, but for
now, this is an improvements. I made a few small adjustments myself.

I had long forgotten this old patch. Thanks for resurrecting it and pushing!

======
Kind Regards,
Peter Smith.
Fujitsu Australia