Re: Overloading functions that are used by operators.

From: Andreas Pflug <pgadmin(at)pse-consulting(dot)de>
To: Dave Page <dpage(at)vale-housing(dot)co(dot)uk>
Cc: Donald Fraser <demolish(at)cwgsy(dot)net>, pgadmin-support(at)postgresql(dot)org
Subject: Re: Overloading functions that are used by operators.
Date: 2003-07-10 11:52:23
Message-ID: 3F0D5377.7000007@pse-consulting.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

Dave Page wrote:

>
>
> -----Original Message-----
> *From:* Donald Fraser [mailto:demolish(at)cwgsy(dot)net]
> *Sent:* 10 July 2003 11:37
> *To:* Dave Page
> *Subject:* Fw: [pgadmin-support] Overloading functions that are
> used by operators.
>
> I it difficult to understand exactly how the query can use the
> left and right operands combined with the function name?
> Given the explain on the query I notice the following lines:
>
> -> Index Scan using pg_proc_oid_index on pg_proc po
> (cost=0.00..5.98 rows=1 width=68)
> Index Cond: (po.oid = ("outer".oprcode)::oid)
> -> Index Scan using pg_proc_oid_index on pg_proc pr
> (cost=0.00..5.98 rows=1 width=68)
> Index Cond: (pr.oid = ("outer".oprrest)::oid)
> -> Index Scan using pg_proc_oid_index on pg_proc pj
> (cost=0.00..5.98 rows=1 width=68)
> Index Cond: (pj.oid = ("outer".oprjoin)::oid)
>
> Now how does for example ("outer".oprcode)::oid get converted to
> an oid using the function name and the left and right operands?
> For the best of my knowledge it has to be converted via the
> function 'regprocin' as there are no arguments in the 'oprcode'
> column.
> I know my SQL isn't the best, and I therefore apologise if I have
> missunderstood something basic here, but I don't see where the
> operands get combnied so the the oid can be found via function
> 'regprocedurein'.
>
>
> You're right, it doesn't - but then pgAdmin doesn't care anyway. All
> it's trying to do is display the function name and the operand types.
> oprcode is adequate to get the correct function name (though not the
> exact signature), and the left and/or right operands come from
> oprleft/oprright.
>
> Anyway, the following patch appears to get rid of the error, and leave
> things looking correct on my system:
>
>
> Index: pgOperator.cpp
> ===================================================================
> RCS file: /disk1/cvsroot/pgadmin3/src/schema/pgOperator.cpp,v
> retrieving revision 1.16
> diff -r1.16 pgOperator.cpp
> 148c148
> < wxT(" po.proname as operproc, pj.proname as joinproc, pr.proname as
> restrproc, description\n")
> ---
>> wxT(" op.oprcode as operproc, op.oprjoin as joinproc, op.oprrest as
> restrproc, description\n")
> 159,161d158
> < wxT(" JOIN pg_proc po ON po.oid=op.oprcode\n")
> < wxT(" LEFT OUTER JOIN pg_proc pr ON pr.oid=op.oprrest\n")
> < wxT(" LEFT OUTER JOIN pg_proc pj ON pj.oid=op.oprjoin\n")
>
> Look OK to you Andreas?
>
It "kind-of" works like this, but the question why the join won't work
for Donald is still not answered.
I created the same stuff as Donald, and pgadmin works ok.
On my 7.4, po.oid=op.oprcode is evaluated as ::oid=::oid. Maybe on 7.3
this is done po.oid::regproc::text=op.oprcode::regproc::text, which
could lead to that problem.

Regards,
Andreas

In response to

Browse pgadmin-support by date

  From Date Subject
Next Message Dave Page 2003-07-10 12:07:11 Re: Overloading functions that are used by operators.
Previous Message Dave Page 2003-07-10 11:32:21 Re: Overloading functions that are used by operators.