Skip site navigation (1) Skip section navigation (2)

Re: Overloading functions that are used by operators.

From: "Dave Page" <dpage(at)vale-housing(dot)co(dot)uk>
To: "Donald Fraser" <demolish(at)cwgsy(dot)net>
Cc: <pgadmin-support(at)postgresql(dot)org>,"Andreas Pflug" <pgadmin(at)pse-consulting(dot)de>
Subject: Re: Overloading functions that are used by operators.
Date: 2003-07-10 11:32:21
Message-ID: 03AF4E498C591348A42FC93DEA9661B83AF170@mail.vale-housing.co.uk (view raw or flat)
Thread:
Lists: pgadmin-support
 

	-----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?

Regards, Dave. 

Responses

pgadmin-support by date

Next:From: Andreas PflugDate: 2003-07-10 11:52:23
Subject: Re: Overloading functions that are used by operators.
Previous:From: Andreas PflugDate: 2003-07-10 11:01:43
Subject: Re: Overloading functions that are used by operators.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group