X-Original-To: pgadmin-support-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 70D4BB430C2; Tue, 8 Jul 2003 19:58:21 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 24260-08; Tue, 8 Jul 2003 16:57:49 -0300 (ADT) Received: from gsy_sbs_1.cisx.com (unknown [213.133.202.58]) by svr1.postgresql.org (Postfix) with ESMTP id BB1DBB4315B; Tue, 8 Jul 2003 16:57:46 -0300 (ADT) Received: from DEMOLITION ([192.168.100.22]) by gsy_sbs_1.cisx.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id 3PK1LZY7; Tue, 8 Jul 2003 20:48:57 +0100 Message-ID: <00c801c3458b$8c139490$1664a8c0@DEMOLITION> From: "Donald Fraser" To: "[ADMIN]" Cc: "[pgADMIN]" Subject: Overloading functions that are used by operators. Date: Tue, 8 Jul 2003 21:00:09 +0100 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00C5_01C34593.EAC78840" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4927.1200 X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4927.1200 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/65 X-Sequence-Number: 1665 This is a multi-part message in MIME format. ------=_NextPart_000_00C5_01C34593.EAC78840 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I have a question regarding operators which are causing problems with the n= ew pgAdmin III software being developed and my database. The problem has been discussed in depth with the pgAdmin III development te= am and they have not been able to resolve the issue and suggested that I ha= ve either done something that I shouldn't have of or that there is a possib= le bug with postgresql. Background information: I have my own data type ('citext') that uses many of the built-in system fu= nctions based on the fact that the storage is identical to the data type 't= ext'. For example I have overloaded the function 'textcat' and the definition I h= ave used is: CREATE FUNCTION pg_catalog.textcat(citext, citext) RETURNS citext AS 'textc= at' LANGUAGE 'internal' IMMUTABLE STRICT; When you view the functions via the pg_proc table you will see that there a= re two functions with 'textcat' in the column pg_proc.proname. I have been using the database for over a year and had no reported problems= with using the operator || on data types 'text', 'varchar', 'bpchar' or ca= lling the overloaded function 'textcat(citext, citext)'. First question: Am I allowed to overload functions, for example the 'textcat' function, whe= n they are being used by system operators? If the answer is no then read no further - the problem is mine and I will h= ave to work around it. The system has at least three operators such as: ||(text,text) ||(varchar, text) ||(bpchar, text) All use the function 'textcat'. Now the new pgAdmin III software interrogates the pg_operator table to extr= act as much information as possible about the operators. They are using the following SQL statement to retrieve the information that= they want. SELECT op.oid, op.oprname, pg_get_userbyid(op.oprowner) as opowner, op.oprk= ind, op.oprcanhash,=20 op.oprleft, op.oprright,=20 lt.typname as lefttype,=20 rt.typname as righttype,=20 et.typname as resulttype,=20 co.oprname as compop,=20 ne.oprname as negop,=20 lso.oprname as leftsortop,=20 rso.oprname as rightsortop,=20 lco.oprname as lscmpop,=20 gco.oprname as gtcmpop,=20 po.proname as operproc,=20 pj.proname as joinproc,=20 pr.proname as restrproc,=20 description=20 FROM pg_operator op=20 JOIN pg_type lt ON lt.oid=3Dop.oprleft=20 JOIN pg_type rt ON rt.oid=3Dop.oprright=20 JOIN pg_type et on et.oid=3Dop.oprresult=20 LEFT OUTER JOIN pg_operator co ON co.oid=3Dop.oprcom=20 LEFT OUTER JOIN pg_operator ne ON ne.oid=3Dop.oprnegate=20 LEFT OUTER JOIN pg_operator lso ON lso.oid=3Dop.oprlsortop=20 LEFT OUTER JOIN pg_operator rso ON rso.oid=3Dop.oprrsortop=20 LEFT OUTER JOIN pg_operator lco ON lco.oid=3Dop.oprltcmpop=20 LEFT OUTER JOIN pg_operator gco ON gco.oid=3Dop.oprgtcmpop=20 JOIN pg_proc po ON po.oid=3Dop.oprcode=20 LEFT OUTER JOIN pg_proc pr ON pr.oid=3Dop.oprrest=20 LEFT OUTER JOIN pg_proc pj ON pj.oid=3Dop.oprjoin=20 LEFT OUTER JOIN pg_description des ON des.objoid=3Dop.oid=20 WHERE op.oprnamespace =3D 2200::oid=20 ORDER BY op.oprname The offending part of this SQL statement is the join: JOIN pg_proc po ON po.oid=3Dop.oprcode It produces the error message "ERROR: There is more than one procedure name= d textcat". Investigation into this has shown that the type conversion of the column na= med pg_operator.oprcode to type oid is done by the function call to: regprocin('textcat') My question would be - what is the correct way to find the function's oid t= hat this operator uses? But first read on in case it is not necessary... It seems to me that the join statements they are using are unnecessary so l= ong as the column pg_operator.oprcode has the identical name to its matchin= g function that has its name defined by column pg_proc.proname, which seems= to be the only data that they are using. On a similar basis, do the columns named pg_operator.oprjoin and pg_operato= r.oprrest have identical names defined by the column pg_proc.proname for wh= ich they are also retrieving? If so then those corresponding joins are also= unnecessarily. Many thanks in advance, regards Donald Fraser. ------=_NextPart_000_00C5_01C34593.EAC78840 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I have a question regarding operators=20 which are causing problems with the new pgAdmin III software bein= g=20 developed and my database.
The problem has been discussed in depth wi= th the=20 pgAdmin III development team and they have not been able to resolve the iss= ue=20 and suggested that I have either done something that I shouldn't have of or= that=20 there is a possible bug with postgresql.
 
Background information:
I have my own data type ('citext') that us= es many=20 of the built-in system functions based on the fact that the storage is iden= tical=20 to the data type 'text'.
For example I have overloaded the function= =20 'textcat' and the definition I have used is:
CREATE=20 FUNCTION pg_catalog.textcat(cit= ext,=20 citext) RETURNS citext AS 'text= cat'=20 LANGUAGE 'internal' IMMUTABLE= =20 STRICT;
When you view the functions via the pg_pro= c table=20 you will see that there are two functions with 'textcat' in the column=20 pg_proc.proname.
I have been using the database for over a = year and=20 had no reported problems with using the operator || on data types 'text',= =20 'varchar', 'bpchar' or calling the overloaded function 'textcat(citext= ,=20 citext)'.
 
First question:
Am I allowed to overload functions, for=20 example the 'textcat' function, when they are being use= d by=20 system operators?
 
If the answer is no then read no further -= the=20 problem is mine and I will have to work around it.
 
The system has at least three operators su= ch=20 as:
||(text,text)
||(varchar, text)
||(bpchar, text)
All use the function 'textcat'.
 
Now the new pgAdmin III software interroga= tes the=20 pg_operator table to extract as much information as possible about the=20 operators.
They are using the following SQL statement= to=20 retrieve the information that they want.
 
SELECT op.= oid,=20 op.oprname, pg_get_userbyid(op.oprowner) as opown= er,=20 op.oprkind, op.oprcanhash,
op.oprleft, op.oprright,
lt.typname as=20 lefttype,
rt.typname as righttype,
et.typname as=20 resulttype,
co.oprname as compop,=20
ne.oprname as negop,
lso.oprname as leftsortop,
rso.oprname as=20 rightsortop,
lco.oprname as=20 lscmpop,
gco.oprname as=20 gtcmpop,
po.proname as=20 operproc,
pj.proname as joinproc,
pr.proname as=20 restrproc,
description
FROM pg_op= erator op=20
JOIN pg_type lt ON lt.oid=3Dop.oprleft
JOIN pg_type rt ON rt.oid=3Dop.oprright
JOIN pg_type et on et.oid=3Dop.oprresult
LEFT OUTER JOIN pg_operator co ON co.oid=3Dop.oprcom =
LEFT OUTER JOIN pg_operator ne ON ne.oid=3Dop.oprnegate
LEFT OUTER JOIN pg_operator lso ON lso.oid=3Dop.oprlsortop
LEFT OUTER JOIN pg_operator rso ON rso.oid=3Dop.oprrsortop
LEFT OUTER JOIN pg_operator lco ON lco.oid=3Dop.oprltcmpop
LEFT OUTER JOIN pg_operator gco ON gco.oid=3Dop.oprgtcmpop
JOIN pg_proc po ON po.oid=3Dop.oprcode
LEFT OUTER JOIN pg_proc pr ON pr.oid=3Dop.oprrest
LEFT OUTER JOIN pg_proc pj ON pj.oid=3Dop.oprjoin
LEFT OUTER JOIN pg_description des= =20 ON des.objoid=3Dop.oid= =20
WHERE op.o= prnamespace=20 =3D 2200::oid
ORDER BY= =20 op.oprname
 
The offending part of this SQL statement i= s the=20 join:
JOIN pg_proc po ON po.oid=3Dop.oprcode
 
It produces the error message "ERROR: Ther= e is more=20 than one procedure named textcat".
Investigation into this has shown that the= type=20 conversion of the column named pg_operator.oprcode to type oid is done by t= he=20 function call to:
regprocin('textcat')
My question would be - what is the correct= way to=20 find the function's oid that this operator uses? But first read on in case = it is=20 not necessary...
It seems to me that the join statements th= ey are=20 using are unnecessary so long as the column pg_operator.oprcode has the=20 identical name to its matching function that has its name defined by column= =20 pg_proc.proname, which seems to be the only data that they are=20 using.
 
On a similar basis, do the columns na= med=20 pg_operator.oprjoin and pg_operator.oprrest have identical names defined by= the=20 column pg_proc.proname for which they are also retrieving? If so then = those=20 corresponding joins are also unnecessarily.
 
Many thanks in advance,
regards
Donald=20 Fraser.
------=_NextPart_000_00C5_01C34593.EAC78840--