On Sat, Aug 03, 2019 at 11:40:24AM +0200, Julien Rouhaud wrote:
> I probably write less perl than Michael, but it looks just fine to me.

Indentation with pgperltidy complains with the attached diff (based on
top of v4).

+printf "Patches should use a more-or-less consecutive range of OIDs.\n";
"Patches should try to use a consecutive range of OIDs"?

Why choosing a random position within [8000,9999]?  This leads to the
following messages for example with multiple runs, which is confusing:
Suggested random unused OID: 9473 (527 consecutive OID(s) available
Suggested random unused OID: 8159 (31 consecutive OID(s) available
Suggested random unused OID: 9491 (509 consecutive OID(s) available

Wouldn't it be better to choose the lowest position in the development
range, and then adapt the suggestion based on that?  We could
recommend the range if there are at least 10 OIDs available in the
range from the lowest position, and there are few patches eating more
than 5-10 OIDs at once.
--
Michael
diff --git a/src/include/catalog/unused_oids b/src/include/catalog/unused_oids
index e613bbc2d1..3903dc1f5b 100755
--- a/src/include/catalog/unused_oids
+++ b/src/include/catalog/unused_oids
@@ -38,7 +38,7 @@ my $FirstGenbkiObjectId =
 push @{$oids}, $FirstGenbkiObjectId;
 
 my $prev_oid = 0;
-my @sortedoids = sort {$a <=> $b} @{$oids};
+my @sortedoids = sort { $a <=> $b } @{$oids};
 foreach my $oid (@sortedoids)
 {
 	if ($oid > $prev_oid + 1)
@@ -72,5 +72,7 @@ foreach my $oid (@sortedoids)
 }
 
 printf "Patches should use a more-or-less consecutive range of OIDs.\n";
-printf "Best practice is to start with a random choice in the range 8000-9999.\n";
-printf "Suggested random unused OID: $suggestion ($navailable consecutive OID(s) available starting here)\n";
+printf
+  "Best practice is to start with a random choice in the range 8000-9999.\n";
+printf
+  "Suggested random unused OID: $suggestion ($navailable consecutive OID(s) available starting here)\n";

Attachment: signature.asc
Description: PGP signature

Reply via email to