An operator function is selected by
it's name, and the left and/or right operands. pgAdmin is doing this
because the query uses pg_operator.oprleft and oprright so it knows the
types.
pgAdmin II is correct - there are 643 operators in pg_catalog
in PostgreSQL 7.3.x. The major reason why pgAdmin II gets it right is because
unlike pgAdmin III it simply does a select on pg_operator. The rest of the
details (function/type names etc) are retrieved from internal
caches.
In pgAdmin III's case, the much more complex query obviously has a
problem somewhere as it is not returning the correct number of
operators.
I think the correct query is:
SELECT op.oid, op.oprname, pg_get_userbyid(op.oprowner) as opowner,
op.oprkind,
op.oprcanhash,
op.oprleft, op.oprright, lt.typname as lefttype, rt.typname as righttype, et.typname as resulttype, co.oprname as compop, ne.oprname as negop, lso.oprname as leftsortop, rso.oprname as rightsortop, lco.oprname as lscmpop, gco.oprname as gtcmpop, po.proname as operproc, pj.proname as joinproc, pr.proname as restrproc, description FROM pg_operator op LEFT OUTER JOIN pg_type lt ON lt.oid=op.oprleft LEFT OUTER JOIN pg_type rt ON rt.oid=op.oprright JOIN pg_type et on et.oid=op.oprresult LEFT OUTER JOIN pg_operator co ON co.oid=op.oprcom LEFT OUTER JOIN pg_operator ne ON ne.oid=op.oprnegate LEFT OUTER JOIN pg_operator lso ON lso.oid=op.oprlsortop LEFT OUTER JOIN pg_operator rso ON rso.oid=op.oprrsortop LEFT OUTER JOIN pg_operator lco ON lco.oid=op.oprltcmpop LEFT OUTER JOIN pg_operator gco ON gco.oid=op.oprgtcmpop JOIN pg_proc po ON po.oid=op.oprcode LEFT OUTER JOIN pg_proc pr ON pr.oid=op.oprrest LEFT OUTER JOIN pg_proc pj ON pj.oid=op.oprjoin LEFT OUTER JOIN pg_description des ON des.objoid=op.oid Note the addition of LEFT OUTER to the lt and rt table joins. It looks
like the unary operators were getting ignored.
Andreas: Please check this and confirm I'm right.
Regards, Dave.
|
Title: Message
- [pgadmin-support] Overloading functions that are used by ope... Donald Fraser
- Re: [pgadmin-support] Overloading functions that are us... Andreas Pflug
- Re: [pgadmin-support] Overloading functions that are us... Dave Page
- Re: [pgadmin-support] Overloading functions that ar... Donald Fraser
- Fw: [pgadmin-support] Overloading functions that are us... Donald Fraser
- Re: [pgadmin-support] Overloading functions that are us... Dave Page
- Re: [pgadmin-support] Overloading functions that are us... Dave Page
- Re: [pgadmin-support] Overloading functions that ar... Donald Fraser
- Re: [pgadmin-support] Overloading functions that are us... Donald Fraser
- Re: [pgadmin-support] Overloading functions that are us... Dave Page