*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.9 1996/11/13 20:47:53 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.10 1996/11/30 18:05:57 momjian Exp $
*
*
* INTERFACE ROUTINES
0);
if (!HeapTupleIsValid(tuple))
- func_error("BuildFuncTupleDesc", funcname, nargs, (int*)argtypes);
+ func_error("BuildFuncTupleDesc", funcname, nargs, argtypes);
retType = ((Form_pg_proc)GETSTRUCT(tuple))->prorettype;
if (!HeapTupleIsValid(proc_tup)) {
func_error("index_create", FIgetname(funcInfo),
FIgetnArgs(funcInfo),
- (int*) FIgetArglist(funcInfo));
+ FIgetArglist(funcInfo));
}
FIgetProcOid(funcInfo) = proc_tup->t_oid;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.6 1996/11/08 00:44:33 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.7 1996/11/30 18:06:03 momjian Exp $
*
* NOTES
* these routines moved here from commands/define.c and somewhat cleaned up.
0);
if (!PointerIsValid(tup))
- func_error("OperatorDef", procedureName, nargs, (int*)typeId);
+ func_error("OperatorDef", procedureName, nargs, typeId);
values[ Anum_pg_operator_oprcode-1 ] = ObjectIdGetDatum(tup->t_oid);
values[ Anum_pg_operator_oprresult-1 ] =
ObjectIdGetDatum(typeId),
0);
if (!HeapTupleIsValid(tup))
- func_error("OperatorDef", restrictionName, 5, (int*)typeId);
+ func_error("OperatorDef", restrictionName, 5, typeId);
values[ Anum_pg_operator_oprrest-1 ] = ObjectIdGetDatum(tup->t_oid);
} else
Int32GetDatum(typeId),
0);
if (!HeapTupleIsValid(tup))
- func_error("OperatorDef", joinName, 5, (int*)typeId);
+ func_error("OperatorDef", joinName, 5, typeId);
values[Anum_pg_operator_oprjoin-1] = ObjectIdGetDatum(tup->t_oid);
} else
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.4 1996/11/06 07:31:26 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.5 1996/11/30 18:06:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
0);
}
if (!HeapTupleIsValid(tup)) {
- func_error("TypeCreate", procname, 1, (int*)argList);
+ func_error("TypeCreate", procname, 1, argList);
}
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.6 1996/11/06 08:21:38 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.7 1996/11/30 18:06:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
Int32GetDatum(nargs),
PointerGetDatum(argList),0);
if (!HeapTupleIsValid(tup))
- func_error("RemoveFunction", functionName, nargs, (int*)argList);
+ func_error("RemoveFunction", functionName, nargs, argList);
#ifndef NO_SECURITY
userName = GetPgUserName();
{
heap_endscan(scan);
heap_close(relation);
- func_error("RemoveFunction", functionName,nargs, (int*)argList);
+ func_error("RemoveFunction", functionName,nargs, argList);
}
/* ok, function has been found */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.17 1996/11/29 15:56:16 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.18 1996/11/30 18:06:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
Node *expr,
List *arrayRef)
{
- int type_id, type_len, attrtype, attrlen;
+ Oid type_id, attrtype;
+ int type_len, attrlen;
int resdomno;
Relation rd;
bool attrisset;
elog(WARN, "make_targetlist_expr: invalid use of NULL expression");
type_id = exprType(expr);
- if (!type_id) {
+ if (type_id == InvalidOid) {
type_len = 0;
} else
type_len = tlen(get_id_type(type_id));
}
} else if((Typecast_ok) && (attrtype != type_id)){
lnext(expr) =
- parser_typecast2(expr, get_id_type((long)attrtype));
+ parser_typecast2(expr, get_id_type(attrtype));
} else
if (attrtype != type_id) {
if ((attrtype == INT2OID) && (type_id == INT4OID))
Oid typelem = get_typelem(attrtype);
expr = (Node*)parser_typecast2(expr,
type_id,
- get_id_type((long)typelem),
+ get_id_type(typelem),
attrlen);
} else
expr = (Node*)parser_typecast2(expr,
type_id,
- get_id_type((long)attrtype),
+ get_id_type(attrtype),
attrlen);
} else {
/* currently, we can't handle casting of expressions */
Oid order_opid;
order_op = oper("<",restype,restype);
- order_opid = (Oid)oprid(order_op);
+ order_opid = oprid(order_op);
return order_opid;
}
i<nargs;
i++, current_fargs = lnext(current_fargs)) {
- if (input_typeids[i] == UNKNOWNOID && function_typeids[i] != 0) {
+ if (input_typeids[i] == UNKNOWNOID && function_typeids[i] != InvalidOid) {
lfirst(current_fargs) =
parser_typecast2(lfirst(current_fargs),
input_typeids[i],
return NULL;
}
-static bool is_lowercase(char *string)
+static
+bool is_lowercase(char *string)
{
int i;
return true;
}
-static void make_lowercase(char *string)
+static
+void make_lowercase(char *string)
{
int i;
* it is a set, treat it like a function and drop through.
*/
if (get_attnum(relid, funcname) != InvalidAttrNumber) {
- int dummyTypeId;
+ Oid dummyTypeId;
return
((Node*)make_var(pstate,
} else {
/* try one more time with lowercase --djm 8/17/96 */
if(!is_lowercase(funcname)) {
- char *lowercase_funcname = strdup(funcname);
+ char *lowercase_funcname = pstrdup(funcname);
make_lowercase(lowercase_funcname);
if (strcmp(lowercase_funcname, "count") == 0)
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/Attic/catalog_utils.c,v 1.11 1996/11/26 03:17:47 bryanh Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/Attic/catalog_utils.c,v 1.12 1996/11/30 18:06:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
*/
static int
binary_oper_get_candidates(char *opname,
- int leftTypeId,
- int rightTypeId,
+ Oid leftTypeId,
+ Oid rightTypeId,
CandidateList *candidates)
{
CandidateList current_candidate;
{
CandidateList result;
CandidateList promotedCandidates = NULL;
- int leftarg, rightarg;
+ Oid leftarg, rightarg;
for (result = candidates; result != NULL; result = result->next) {
CandidateList c;
* try to choose a default pair
*/
static CandidateList
-binary_oper_select_candidate(int arg1,
- int arg2,
+binary_oper_select_candidate(Oid arg1,
+ Oid arg2,
CandidateList candidates)
{
CandidateList result;
/* Given operator, types of arg1, and arg2, return oper struct */
/* arg1, arg2 --typeids */
Operator
-oper(char *op, int arg1, int arg2)
+oper(char *op, Oid arg1, Oid arg2)
{
HeapTuple tup;
CandidateList candidates;
*/
static int
unary_oper_get_candidates(char *op,
- int typeId,
+ Oid typeId,
CandidateList *candidates,
char rightleft)
{
/* Given unary right-side operator (operator on right), return oper struct */
/* arg-- type id */
Operator
-right_oper(char *op, int arg)
+right_oper(char *op, Oid arg)
{
HeapTuple tup;
CandidateList candidates;
/* Given unary left-side operator (operator on left), return oper struct */
/* arg--type id */
Operator
-left_oper(char *op, int arg)
+left_oper(char *op, Oid arg)
{
HeapTuple tup;
CandidateList candidates;
return (NULL);
}
-static bool is_lowercase(char *string)
+static
+bool is_lowercase(char *string)
{
int i;
return true;
}
-static void make_lowercase(char *string)
+static
+void make_lowercase(char *string)
{
int i;
funcname);
elog(NOTICE, "that satisfies the given argument types. you will have to");
elog(NOTICE, "retype your query using explicit typecasts.");
- func_error("func_get_detail", funcname, nargs, (int*)oid_array);
+ func_error("func_get_detail", funcname, nargs, oid_array);
}
else {
ftup = SearchSysCacheTuple(PRONAME,
elog(WARN, "no such attribute or function \"%s\"",
funcname);
}
- func_error("func_get_detail", funcname, nargs, (int*)oid_array);
+ func_error("func_get_detail", funcname, nargs, oid_array);
}
} else {
pform = (Form_pg_proc) GETSTRUCT(ftup);
/* Given a type id, returns the in-conversion function of the type */
Oid
-typeid_get_retinfunc(int type_id)
+typeid_get_retinfunc(Oid type_id)
{
- HeapTuple typeTuple;
+ HeapTuple typeTuple;
TypeTupleForm type;
Oid infunc;
typeTuple = SearchSysCacheTuple(TYPOID,
0,0,0);
if ( !HeapTupleIsValid ( typeTuple ))
elog(WARN,
- "typeid_get_retinfunc: Invalid type - oid = %d",
+ "typeid_get_retinfunc: Invalid type - oid = %ud",
type_id);
type = (TypeTupleForm) GETSTRUCT(typeTuple);
}
Oid
-typeid_get_relid(int type_id)
+typeid_get_relid(Oid type_id)
{
- HeapTuple typeTuple;
+ HeapTuple typeTuple;
TypeTupleForm type;
Oid infunc;
typeTuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(type_id),
0,0,0);
if ( !HeapTupleIsValid ( typeTuple ))
- elog(WARN, "typeid_get_relid: Invalid type - oid = %d ", type_id);
+ elog(WARN, "typeid_get_relid: Invalid type - oid = %ud ", type_id);
type = (TypeTupleForm) GETSTRUCT(typeTuple);
infunc = type->typrelid;
return(infunc);
}
-Oid get_typrelid(Type typ)
+Oid
+get_typrelid(Type typ)
{
TypeTupleForm typtup;
Oid
get_typelem(Oid type_id)
{
- HeapTuple typeTuple;
+ HeapTuple typeTuple;
TypeTupleForm type;
if (!(typeTuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(type_id),
0,0,0))) {
- elog (WARN , "type id lookup of %d failed", type_id);
+ elog (WARN , "type id lookup of %ud failed", type_id);
}
type = (TypeTupleForm) GETSTRUCT(typeTuple);
char
FindDelimiter(char *typename)
{
- char delim;
- HeapTuple typeTuple;
+ char delim;
+ HeapTuple typeTuple;
TypeTupleForm type;
* is not found.
*/
void
-op_error(char *op, int arg1, int arg2)
+op_error(char *op, Oid arg1, Oid arg2)
{
Type tp1 = NULL, tp2 = NULL;
* argument types
*/
void
-func_error(char *caller, char *funcname, int nargs, int *argtypes)
+func_error(char *caller, char *funcname, int nargs, Oid *argtypes)
{
Type get_id_type();
char p[(NAMEDATALEN+2)*MAXFMGRARGS], *ptr;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/Attic/parse_query.c,v 1.9 1996/11/19 05:06:39 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/Attic/parse_query.c,v 1.10 1996/11/30 18:06:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
List *te_tail = NIL, *te_head = NIL;
Var *varnode;
int varattno, maxattrs;
- int type_id, type_len;
+ Oid type_id;
+ int type_len;
RangeTblEntry *rte;
rte = refnameRangeTableEntry(pstate->p_rtable, refname);
* set itself is not. */
te->resdom = makeResdom((AttrNumber) (*this_resno)++,
- (Oid)type_id,
+ type_id,
(Size)type_len,
attrname,
(Index)0,
static Node *
make_operand(char *opname,
Node *tree,
- int orig_typeId,
- int true_typeId)
+ Oid orig_typeId,
+ Oid true_typeId)
{
Node *result;
Type true_type;
Expr *
make_op(char *opname, Node *ltree, Node *rtree)
{
- int ltypeId, rtypeId;
+ Oid ltypeId, rtypeId;
Operator temp;
OperatorTupleForm opform;
Oper *newop;
return result;
}
-int
+Oid
find_atttype(Oid relid, char *attrname)
{
- int attid, vartype;
+ int attid;
+ Oid vartype;
Relation rd;
rd = heap_open(relid);
Var *
-make_var(ParseState *pstate, char *refname, char *attrname, int *type_id)
+make_var(ParseState *pstate, char *refname, char *attrname, Oid *type_id)
{
Var *varnode;
- int vnum, attid, vartypeid;
+ int vnum, attid;
+ Oid vartypeid;
Relation rd;
RangeTblEntry *rte;
rd = heap_open(rte->relid);
- attid = nf_varattno(rd, (char *) attrname);
+ attid = nf_varattno(rd, attrname);
if (attid == InvalidAttrNumber)
elog(WARN, "Invalid attribute %s\n", attrname);
vartypeid = att_typeid(rd, attid);
make_array_ref(Node *expr,
List *indirection)
{
- Oid typearray;
- HeapTuple type_tuple;
+ Oid typearray;
+ HeapTuple type_tuple;
TypeTupleForm type_struct_array, type_struct_element;
- ArrayRef *aref;
- int reftype;
+ ArrayRef *aref;
+ Oid reftype;
List *upperIndexpr=NIL;
List *lowerIndexpr=NIL;
- typearray = (Oid) exprType(expr);
+ typearray = exprType(expr);
type_tuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(typearray),
List *lowerIndexpr,
Expr *expr)
{
- Oid typearray;
- HeapTuple type_tuple;
+ Oid typearray;
+ HeapTuple type_tuple;
TypeTupleForm type_struct_array;
TypeTupleForm type_struct_element;
- ArrayRef *aref;
- int reftype;
+ ArrayRef *aref;
+ Oid reftype;
typearray = exprType((Node*)target_expr);
checkTargetTypes(ParseState *pstate, char *target_colname,
char *refname, char *colname)
{
- int attrtype_id, attrtype_target, resdomno_id, resdomno_target;
+ Oid attrtype_id, attrtype_target;
+ int resdomno_id, resdomno_target;
Relation rd;
RangeTblEntry *rte;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.13 1996/11/30 17:49:02 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.14 1996/11/30 18:06:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
}
Node *
-parser_typecast2(Node *expr, int exprType, Type tp, int typlen)
+parser_typecast2(Node *expr, Oid exprType, Type tp, int typlen)
{
/* check for passing non-ints */
Const *adt;
const_string = (char *) textout((struct varlena *)const_string);
break;
default:
- elog(WARN,"unknown type%d ",exprType);
+ elog(WARN,"unknown type %ud ",exprType);
}
if (!exprType) {
- adt = makeConst((Oid)typeid(tp),
+ adt = makeConst(typeid(tp),
(Size) 0,
(Datum) NULL,
true, /* isnull */
}
}
- adt = makeConst((Oid)typeid(tp),
+ adt = makeConst(typeid(tp),
(Size)len,
(Datum)lcp,
0,
0 /*was omitted*/,
0 /* not a set */);
/*
- printf("adt %s : %d %d %d\n",CString(expr),typeid(tp) ,
+ printf("adt %s : %ud %d %d\n",CString(expr),typeid(tp) ,
len,cp);
*/
if (string_palloced) pfree(const_string);
return aggreg;
}
-
-
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/Attic/aclchk.c,v 1.4 1996/11/08 05:59:23 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/Attic/aclchk.c,v 1.5 1996/11/30 18:06:45 momjian Exp $
*
* NOTES
* See acl.h.
PointerGetDatum(arglist),
0);
if (!HeapTupleIsValid(htp))
- func_error("pg_func_ownercheck", funcname, nargs, (int*)arglist);
+ func_error("pg_func_ownercheck", funcname, nargs, arglist);
owner_id = ((Form_pg_proc) GETSTRUCT(htp))->proowner;
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: catalog_utils.h,v 1.4 1996/11/04 12:12:47 scrappy Exp $
+ * $Id: catalog_utils.h,v 1.5 1996/11/30 18:06:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
extern char *tname(Type t);
extern int tbyvalue(Type t);
extern Oid oprid(Operator op);
-extern Operator oper(char *op, int arg1, int arg2);
-extern Operator right_oper(char *op, int arg);
-extern Operator left_oper(char *op, int arg);
+extern Operator oper(char *op, Oid arg1, Oid arg2);
+extern Operator right_oper(char *op, Oid arg);
+extern Operator left_oper(char *op, Oid arg);
extern int varattno(Relation rd, char *a);
extern bool varisset(Relation rd, char *name);
extern int nf_varattno(Relation rd, char *a);
extern Oid funcid_get_rettype(Oid funcid);
extern bool func_get_detail(char *funcname, int nargs, Oid *oid_array,
Oid *funcid, Oid *rettype, bool *retset, Oid **true_typeids);
-extern Oid typeid_get_retinfunc(int type_id);
-extern Oid typeid_get_relid(int type_id);
+extern Oid typeid_get_retinfunc(Oid type_id);
+extern Oid typeid_get_relid(Oid type_id);
extern Oid get_typrelid(Type typ);
extern Oid get_typelem(Oid type_id);
extern char FindDelimiter(char *typename);
-extern void op_error(char *op, int arg1, int arg2);
-extern void func_error(char *caller, char *funcname, int nargs, int *argtypes);
+extern void op_error(char *op, Oid arg1, Oid arg2);
+extern void func_error(char *caller, char *funcname, int nargs, Oid *argtypes);
#endif /* CATALOG_UTILS_H */
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: parse_query.h,v 1.6 1996/11/10 03:05:45 momjian Exp $
+ * $Id: parse_query.h,v 1.7 1996/11/30 18:07:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
int timecode);
extern Expr *make_op(char *opname, Node *ltree, Node *rtree);
-extern int find_atttype(Oid relid, char *attrname);
+extern Oid find_atttype(Oid relid, char *attrname);
extern Var *make_var(ParseState *pstate,
- char *relname, char *attrname, int *type_id);
+ char *relname, char *attrname, Oid *type_id);
extern ArrayRef *make_array_ref(Node *array, List *indirection);
extern ArrayRef *make_array_set(Expr *target_expr, List *upperIndexpr,
List *lowerIndexpr, Expr *expr);
/* parser.c (was ylib.c) */
extern QueryTreeList *parser(char *str, Oid *typev, int nargs);
extern Node *parser_typecast(Value *expr, TypeName *typename, int typlen);
-extern Node *parser_typecast2(Node *expr, int exprType, Type tp, int typlen);
+extern Node *parser_typecast2(Node *expr, Oid exprType, Type tp, int typlen);
extern Aggreg *ParseAgg(char *aggname, Oid basetype, Node *target);
extern void handleTargetColname(ParseState *pstate, char **resname,
char *refname, char *colname);
extern int pfunc_num_args;
/* useful macros */
-#define ISCOMPLEX(type) (typeid_get_relid((Oid)type) ? true : false)
+#define ISCOMPLEX(type) (typeid_get_relid(type) ? true : false)
#endif /* PARSE_QUERY_H */