On Thu, Aug 31, 2023 at 6:23 PM Peter Eisentraut <pe...@eisentraut.org>
wrote:

> Attached is an updated patch set.
>
> One win here is that the ObjectProperty lookup now uses a hash function
> instead of a linear search.  So hopefully the performance is better (to
> be confirmed) and it could now be used for things like [0].

+ # XXX This one neither, but if I add it to @skip, PerfectHash will fail.
(???)
+ #FIXME: AttributeRelationId

I took a quick look at this, and attached is the least invasive way to get
it working for now, which is to bump the table size slightly. The comment
says doing this isn't reliable, but it happens to work in this case.
Playing around with the functions is hit-or-miss, and when that fails,
somehow the larger table saves the day.

--
John Naylor
EDB: http://www.enterprisedb.com
diff --git a/src/backend/catalog/genbki.pl b/src/backend/catalog/genbki.pl
index 199091305c..3640ee154b 100644
--- a/src/backend/catalog/genbki.pl
+++ b/src/backend/catalog/genbki.pl
@@ -223,6 +223,7 @@ foreach my $header (@ARGV)
 
        # XXX These catalogs were not covered by the previous hand-maintained 
table.
        my @skip = qw(
+               AttributeRelationId
                AttrDefaultRelationId EnumRelationId IndexRelationId
                LargeObjectRelationId ParameterAclRelationId
                PublicationNamespaceRelationId PublicationRelRelationId
@@ -235,8 +236,6 @@ foreach my $header (@ARGV)
                SecLabelRelationId SharedSecLabelRelationId
                PartitionedRelationId RangeRelationId SequenceRelationId
                SubscriptionRelRelationId);
-       # XXX This one neither, but if I add it to @skip, PerfectHash will 
fail. (???)
-       #FIXME: AttributeRelationId
 
        # XXX hardcoded ObjectType mapping -- where to put this?
        my %objtypes = (
diff --git a/src/tools/PerfectHash.pm b/src/tools/PerfectHash.pm
index e54905a3ef..f343661859 100644
--- a/src/tools/PerfectHash.pm
+++ b/src/tools/PerfectHash.pm
@@ -200,7 +200,8 @@ sub _construct_hash_table
        # can be rejected due to touching unused hashtable entries.  In 
practice,
        # neither effect seems strong enough to justify using a larger table.)
        my $nedges = scalar @keys;       # number of edges
-       my $nverts = 2 * $nedges + 1;    # number of vertices
+       # WIP for object properties
+       my $nverts = 2 * $nedges + 3;    # number of vertices
 
        # However, it would be very bad if $nverts were exactly equal to either
        # $hash_mult1 or $hash_mult2: effectively, that hash function would be

Reply via email to