Re: Function parameter names - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Function parameter names
Date
Msg-id Pine.LNX.4.44.0311231812080.4773-100000@peter.localdomain
Whole thread Raw
In response to Function parameter names  (Dennis Bjorklund <db@zigo.dhs.org>)
Responses Re: Function parameter names
Re: Function parameter names
List pgsql-hackers
Dennis Bjorklund writes:

> I'm in the middle of implementing function parameter names.

How will that work in arbitrary procedural languages?

> Would it be a good idea to create a namevector in the same way as
> oidvector? Would a normal array like name[] be better?
>
> What is the reason for the oidvector to be it's own type instead of a
> oid[]?

An oidvector is fixed length, so you can access it via a C struct, like
pgprocval->proargtypes[2].  With a normal array, things get much more
complicated, and that cost would be fairly large if you want to resolve
the argument types of function calls.  (This is the reason that the
maximum number of function parameters is limited to some arbitrary
number.)

So these two reasons make a "namevector" impractical: First, it would
probably not be in the performance critical path.  Second, it would use up
a fixed length of NAMEDATALEN * FUNC_MAX_ARGS (currently 1024 bytes) in
every pg_proc row.  In this case, a regular name[] would be more suitable.
Just be sure to put it after all the fixed-length fields.

-- 
Peter Eisentraut   peter_e@gmx.net



pgsql-hackers by date:

Previous
From: Dennis Bjorklund
Date:
Subject: Function parameter names
Next
From: Tom Lane
Date:
Subject: Re: Function parameter names