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