Re: polymorphic arguments and return type for PL/pgSQL - Mailing list pgsql-patches

From Tom Lane
Subject Re: polymorphic arguments and return type for PL/pgSQL
Date
Msg-id 16504.1056998189@sss.pgh.pa.us
Whole thread Raw
In response to Re: polymorphic arguments and return type for PL/pgSQL  (Joe Conway <mail@joeconway.com>)
Responses Re: polymorphic arguments and return type for PL/pgSQL
Re: polymorphic arguments and return type for PL/pgSQL
List pgsql-patches
> Do you think it would be better to do

> 1) a hash lookup by function oid to a linked list of different compiled
> versions (for each set of argument/return types)
>    -or-
> 2) create hash key using a new structure that includes function oid,
> return type, and argument types, and use that for direct lookup.

The latter.  By the time you pay the price of a hash lookup, a slightly
longer key is nearly free.  (Maybe entirely free, since it might produce
better-distributed hash values.)

dynahash only supports fixed-length keys, so don't forget to zero out
unused positions in the argument type vector.

BTW, I can't see any need to include the return type in the hash key ---
wouldn't it be predetermined given the argument types?

            regards, tom lane

pgsql-patches by date:

Previous
From: Joe Conway
Date:
Subject: Re: polymorphic arguments and return type for PL/pgSQL
Next
From: Joe Conway
Date:
Subject: Re: polymorphic arguments and return type for PL/pgSQL