Re: [HACKERS] Names that suddenly include an OID - Mailing list pgsql-hackers

From Tom Ivar Helbekkmo
Subject Re: [HACKERS] Names that suddenly include an OID
Date
Msg-id 86iuitqoa7.fsf@athene.nhh.no
Whole thread Raw
In response to Re: [HACKERS] Names that suddenly include an OID  (Bruce Momjian <maillist@candle.pha.pa.us>)
List pgsql-hackers
Bruce Momjian <maillist@candle.pha.pa.us> writes:

> OK, it was me who added it, and it still has some problems.  The
> reason the oid was added is that the old code just displayed the
> pg_proc.proname for regproc fields, and the input function just
> found the FIRST function with a matching name, which is a problem
> because we can have multiple functions with the same name but
> different types.

Then the code in question should be changed to properly look for a
tuple where the name matches _and_ the types are right.  Combining the
(overloaded) name and the (unique) OID into a text string seems very
inelegant to me, and intuitively very, very wrong: if names aren't
usable in a certain situation, use OIDs instead -- that's what they're
for -- but don't change the name to add (seemingly) random numbers to
make them unique.

Contrived, silly, irrelevant example to illuminate how I'm thinking:
if you used the string 'plus' to signify addition, and you decided you
had to differentiate between adding integers and adding floats, then

    findfunc('plus');

should become

    findfunc('plus', 'integer');

instead of forcing the programmer to write things like

    findfunc('plus_234893');

or adding weird code to every use of 'plus' to look up what the silly,
composite name happens to be this time.

-tih
--
Popularity is the hallmark of mediocrity.  --Niles Crane, "Frasier"


--ELM906585503-11559-0_

--ELM906585503-11559-0_--

pgsql-hackers by date:

Previous
From: Tom Ivar Helbekkmo
Date:
Subject: Re: [HACKERS] Names that suddenly include an OID
Next
From: Oleg Bartunov
Date:
Subject: AbortTransaction and not in in-progress state