Fix for regproc
This commit is contained in:
parent
50676b40ac
commit
24a05f5b3e
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.21 1998/08/31 07:19:56 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.22 1998/08/31 07:55:47 momjian Exp $
|
||||||
*
|
*
|
||||||
* HISTORY
|
* HISTORY
|
||||||
* AUTHOR DATE MAJOR EVENT
|
* AUTHOR DATE MAJOR EVENT
|
||||||
@ -199,7 +199,8 @@ bool
|
|||||||
or_clause(Node *clause)
|
or_clause(Node *clause)
|
||||||
{
|
{
|
||||||
return clause != NULL &&
|
return clause != NULL &&
|
||||||
nodeTag(clause) == T_Expr && ((Expr *) clause)->opType == OR_EXPR);
|
nodeTag(clause) == T_Expr &&
|
||||||
|
((Expr *) clause)->opType == OR_EXPR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.23 1998/08/31 07:35:44 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.24 1998/08/31 07:55:48 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -35,12 +35,12 @@
|
|||||||
* proid of NULL signifies unknown
|
* proid of NULL signifies unknown
|
||||||
*/
|
*/
|
||||||
int32
|
int32
|
||||||
regprocin(char *pro_oid_name)
|
regprocin(char *pro_name_and_oid)
|
||||||
{
|
{
|
||||||
HeapTuple proctup;
|
HeapTuple proctup = NULL;
|
||||||
RegProcedure result = (Oid) 0;
|
RegProcedure result = (Oid) 0;
|
||||||
|
|
||||||
if (pro_oid_name == NULL)
|
if (pro_name_and_oid == NULL)
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
|
|
||||||
@ -48,15 +48,25 @@ regprocin(char *pro_oid_name)
|
|||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* we need to use the oid because there can be multiple entries
|
* we need to use the oid because there can be multiple entries
|
||||||
* with the same name, i.e. 1323_int4eq
|
* with the same name. We accept 1323_int4eq and 1323.
|
||||||
*/
|
*/
|
||||||
proctup = SearchSysCacheTuple(PROOID,
|
if (strrchr(pro_name_and_oid,'_') != NULL)
|
||||||
/* atoi stops at the _ */
|
{
|
||||||
ObjectIdGetDatum(atoi(pro_oid_name)),
|
proctup = SearchSysCacheTuple(PROOID,
|
||||||
0, 0, 0);
|
ObjectIdGetDatum(atoi(strrchr(pro_name_and_oid,'_')+1)),
|
||||||
|
0, 0, 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (atoi(pro_name_and_oid) != InvalidOid)
|
||||||
|
{
|
||||||
|
proctup = SearchSysCacheTuple(PROOID,
|
||||||
|
/* atoi stops at the _ */
|
||||||
|
ObjectIdGetDatum(atoi(pro_name_and_oid)),
|
||||||
|
0, 0, 0);
|
||||||
|
}
|
||||||
if (HeapTupleIsValid(proctup))
|
if (HeapTupleIsValid(proctup))
|
||||||
result = (RegProcedure) proctup->t_oid;
|
result = (RegProcedure) proctup->t_oid;
|
||||||
else result = (RegProcedure) 0;
|
else elog(ERROR, "regprocin: no such procedure %s", pro_name_and_oid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -76,7 +86,7 @@ regprocin(char *pro_oid_name)
|
|||||||
(bits16) 0,
|
(bits16) 0,
|
||||||
(AttrNumber) 1,
|
(AttrNumber) 1,
|
||||||
(RegProcedure) F_NAMEEQ,
|
(RegProcedure) F_NAMEEQ,
|
||||||
(Datum) pro_oid_name);
|
(Datum) pro_name_and_oid);
|
||||||
|
|
||||||
procscan = heap_beginscan(proc, 0, SnapshotNow, 1, &key);
|
procscan = heap_beginscan(proc, 0, SnapshotNow, 1, &key);
|
||||||
if (!HeapScanIsValid(procscan))
|
if (!HeapScanIsValid(procscan))
|
||||||
@ -94,7 +104,7 @@ regprocin(char *pro_oid_name)
|
|||||||
RelationGetTupleDescriptor(proc),
|
RelationGetTupleDescriptor(proc),
|
||||||
&isnull);
|
&isnull);
|
||||||
if (isnull)
|
if (isnull)
|
||||||
elog(FATAL, "regprocin: null procedure %s", pro_oid_name);
|
elog(FATAL, "regprocin: null procedure %s", pro_name_and_oid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
result = (RegProcedure) 0;
|
result = (RegProcedure) 0;
|
||||||
@ -104,13 +114,13 @@ regprocin(char *pro_oid_name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef EBUG
|
#ifdef EBUG
|
||||||
elog(DEBUG, "regprocin: no such procedure %s", pro_oid_name);
|
elog(DEBUG, "regprocin: no such procedure %s", pro_name_and_oid);
|
||||||
#endif /* defined(EBUG) */
|
#endif /* defined(EBUG) */
|
||||||
return (int32) result;
|
return (int32) result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* regprocout - converts proid to "pro_oid_name"
|
* regprocout - converts proid to "pro_name_and_oid"
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
regprocout(RegProcedure proid)
|
regprocout(RegProcedure proid)
|
||||||
@ -131,7 +141,7 @@ regprocout(RegProcedure proid)
|
|||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
s = ((Form_pg_proc) GETSTRUCT(proctup))->proname.data;
|
s = ((Form_pg_proc) GETSTRUCT(proctup))->proname.data;
|
||||||
snprintf(result, NAMEDATALEN, "%d_%s", proid, s);
|
snprintf(result, NAMEDATALEN, "%s_%d", s, proid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: builtins.h,v 1.48 1998/08/29 04:09:29 momjian Exp $
|
* $Id: builtins.h,v 1.49 1998/08/31 07:55:50 momjian Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* This should normally only be included by fmgr.h.
|
* This should normally only be included by fmgr.h.
|
||||||
@ -356,7 +356,7 @@ extern bool texticregexne(struct varlena * s, struct varlena * p);
|
|||||||
|
|
||||||
|
|
||||||
/* regproc.c */
|
/* regproc.c */
|
||||||
extern int32 regprocin(char *proname);
|
extern int32 regprocin(char *pro_name_and_oid);
|
||||||
extern char *regprocout(RegProcedure proid);
|
extern char *regprocout(RegProcedure proid);
|
||||||
extern text *oid8types(Oid (*oidArray)[]);
|
extern text *oid8types(Oid (*oidArray)[]);
|
||||||
extern Oid regproctooid(RegProcedure rp);
|
extern Oid regproctooid(RegProcedure rp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user