Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit24a05f5

Browse files
committed
Fix for regproc
1 parent50676b4 commit24a05f5

File tree

3 files changed

+30
-19
lines changed

3 files changed

+30
-19
lines changed

‎src/backend/optimizer/util/clauses.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.21 1998/08/31 07:19:56 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.22 1998/08/31 07:55:47 momjian Exp $
1111
*
1212
* HISTORY
1313
* AUTHORDATEMAJOR EVENT
@@ -199,7 +199,8 @@ bool
199199
or_clause(Node*clause)
200200
{
201201
returnclause!=NULL&&
202-
nodeTag(clause)==T_Expr&& ((Expr*)clause)->opType==OR_EXPR);
202+
nodeTag(clause)==T_Expr&&
203+
((Expr*)clause)->opType==OR_EXPR;
203204
}
204205

205206
/*

‎src/backend/utils/adt/regproc.c

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.23 1998/08/31 07:35:44 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.24 1998/08/31 07:55:48 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -35,28 +35,38 @@
3535
*proid of NULL signifies unknown
3636
*/
3737
int32
38-
regprocin(char*pro_oid_name)
38+
regprocin(char*pro_name_and_oid)
3939
{
40-
HeapTupleproctup;
40+
HeapTupleproctup=NULL;
4141
RegProcedureresult= (Oid)0;
4242

43-
if (pro_oid_name==NULL)
43+
if (pro_name_and_oid==NULL)
4444
return (0);
4545

4646

4747
if (!IsBootstrapProcessingMode())
4848
{
4949
/*
5050
* we need to use the oid because there can be multiple entries
51-
*with the same name, i.e.1323_int4eq
51+
*with the same name. We accept1323_int4eq and 1323.
5252
*/
53-
proctup=SearchSysCacheTuple(PROOID,
54-
/* atoi stops at the _ */
55-
ObjectIdGetDatum(atoi(pro_oid_name)),
56-
0,0,0);
53+
if (strrchr(pro_name_and_oid,'_')!=NULL)
54+
{
55+
proctup=SearchSysCacheTuple(PROOID,
56+
ObjectIdGetDatum(atoi(strrchr(pro_name_and_oid,'_')+1)),
57+
0,0,0);
58+
59+
}
60+
elseif (atoi(pro_name_and_oid)!=InvalidOid)
61+
{
62+
proctup=SearchSysCacheTuple(PROOID,
63+
/* atoi stops at the _ */
64+
ObjectIdGetDatum(atoi(pro_name_and_oid)),
65+
0,0,0);
66+
}
5767
if (HeapTupleIsValid(proctup))
5868
result= (RegProcedure)proctup->t_oid;
59-
elseresult= (RegProcedure)0;
69+
elseelog(ERROR,"regprocin: no such procedure %s",pro_name_and_oid);
6070
}
6171
else
6272
{
@@ -76,7 +86,7 @@ regprocin(char *pro_oid_name)
7686
(bits16)0,
7787
(AttrNumber)1,
7888
(RegProcedure)F_NAMEEQ,
79-
(Datum)pro_oid_name);
89+
(Datum)pro_name_and_oid);
8090

8191
procscan=heap_beginscan(proc,0,SnapshotNow,1,&key);
8292
if (!HeapScanIsValid(procscan))
@@ -94,7 +104,7 @@ regprocin(char *pro_oid_name)
94104
RelationGetTupleDescriptor(proc),
95105
&isnull);
96106
if (isnull)
97-
elog(FATAL,"regprocin: null procedure %s",pro_oid_name);
107+
elog(FATAL,"regprocin: null procedure %s",pro_name_and_oid);
98108
}
99109
else
100110
result= (RegProcedure)0;
@@ -104,13 +114,13 @@ regprocin(char *pro_oid_name)
104114
}
105115

106116
#ifdefEBUG
107-
elog(DEBUG,"regprocin: no such procedure %s",pro_oid_name);
117+
elog(DEBUG,"regprocin: no such procedure %s",pro_name_and_oid);
108118
#endif/* defined(EBUG) */
109119
return (int32)result;
110120
}
111121

112122
/*
113-
*regprocout- converts proid to "pro_oid_name"
123+
*regprocout- converts proid to "pro_name_and_oid"
114124
*/
115125
char*
116126
regprocout(RegProcedureproid)
@@ -131,7 +141,7 @@ regprocout(RegProcedure proid)
131141
char*s;
132142

133143
s= ((Form_pg_proc)GETSTRUCT(proctup))->proname.data;
134-
snprintf(result,NAMEDATALEN,"%d_%s",proid,s);
144+
snprintf(result,NAMEDATALEN,"%s_%d",s,proid);
135145
}
136146
else
137147
{

‎src/include/utils/builtins.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: builtins.h,v 1.48 1998/08/29 04:09:29 momjian Exp $
9+
* $Id: builtins.h,v 1.49 1998/08/31 07:55:50 momjian Exp $
1010
*
1111
* NOTES
1212
* This should normally only be included by fmgr.h.
@@ -356,7 +356,7 @@ extern bool texticregexne(struct varlena * s, struct varlena * p);
356356

357357

358358
/* regproc.c */
359-
externint32regprocin(char*proname);
359+
externint32regprocin(char*pro_name_and_oid);
360360
externchar*regprocout(RegProcedureproid);
361361
externtext*oid8types(Oid (*oidArray)[]);
362362
externOidregproctooid(RegProcedurerp);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp