Remove _all_ PARSEDEBUG print statements.
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.87 1998/09/16 14:25:37 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.88 1998/09/25 13:36:00 thomas Exp $
*
*-------------------------------------------------------------------------
*/
#include "parser/parse_target.h"
#include "utils/builtins.h"
#include "utils/mcxt.h"
-#ifdef PARSEDEBUG
-#include "nodes/print.h"
-#endif
static Query *transformStmt(ParseState *pstate, Node *stmt);
static Query *transformDeleteStmt(ParseState *pstate, DeleteStmt *stmt);
while (pl != NIL)
{
-#ifdef PARSEDEBUG
- elog(DEBUG, "parse tree from yacc:\n---\n%s\n---\n", nodeToString(lfirst(pl)));
-#endif
-
pstate = make_parsestate(parentParseState);
result->qtrees[i++] = transformStmt(pstate, lfirst(pl));
if (pstate->p_target_relation != NULL)
if (column->is_sequence)
{
- char *cstring;
+ char *sname;
+ char *cstring;
CreateSeqStmt *sequence;
+ sname = makeTableName(stmt->relname, column->colname, "seq", NULL);
+
constraint = makeNode(Constraint);
constraint->contype = CONSTR_DEFAULT;
- constraint->name = makeTableName(stmt->relname, column->colname, "seq", NULL);
+ constraint->name = sname;
cstring = palloc(9 + strlen(constraint->name) + 2 + 1);
strcpy(cstring, "nextval('");
strcat(cstring, constraint->name);
}
sequence = makeNode(CreateSeqStmt);
- sequence->seqname = pstrdup(constraint->name);
+ sequence->seqname = pstrdup(sname);
sequence->options = NIL;
elog(NOTICE, "CREATE TABLE will create implicit sequence %s for SERIAL column %s.%s",
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.31 1998/09/16 14:29:35 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.32 1998/09/25 13:36:01 thomas Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
};
*(s+len) = '\0';
-#ifdef PARSEDEBUG
- elog(DEBUG, "flattened string is \"%s\"\n", s);
-#endif
-
return s;
} /* FlattenStringList() */
elog(ERROR,"Internal error in makeConstantList(): cannot encode node");
};
-#ifdef PARSEDEBUG
- elog(DEBUG, "AexprConst argument is \"%s\"\n", defval);
-#endif
-
return result;
} /* makeConstantList() */
cp = rawid;
};
-#ifdef PARSEDEBUG
- elog(DEBUG, "fmtId- %sconvert %s to %s\n",
- ((cp == rawid)? "do not ": ""), rawid, cp);
-#endif
-
return cp;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.25 1998/09/01 04:30:27 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.26 1998/09/25 13:36:03 thomas Exp $
*
*-------------------------------------------------------------------------
*/
{
List *s = NIL;
-#ifdef PARSEDEBUG
- printf("transformSortClause: entering\n");
-#endif
-
while (orderlist != NIL)
{
SortGroupBy *sortby = lfirst(orderlist);
restarget = findTargetlistEntry(pstate, sortby->node, targetlist, ORDER_CLAUSE);
-#ifdef PARSEDEBUG
- printf("transformSortClause: find sorting operator for type %d\n",
- restarget->resdom->restype);
-#endif
-
sortcl->resdom = resdom = restarget->resdom;
/*
/* not a member of the sortclauses yet */
SortClause *sortcl = makeNode(SortClause);
-#ifdef PARSEDEBUG
- printf("transformSortClause: (2) find sorting operator for type %d\n",
- tlelt->resdom->restype);
-#endif
-
if (tlelt->resdom->restype == InvalidOid)
tlelt->resdom->restype = INT4OID;
/* not a member of the sortclauses yet */
SortClause *sortcl = makeNode(SortClause);
-#ifdef PARSEDEBUG
- printf("transformSortClause: try sorting type %d\n",
- tlelt->resdom->restype);
-#endif
-
sortcl->resdom = tlelt->resdom;
sortcl->opoid = any_ordering_op(tlelt->resdom->restype);
otype = ((TargetEntry *) lfirst(prev_target))->resdom->restype;
itype = ((TargetEntry *) lfirst(next_target))->resdom->restype;
-#ifdef PARSEDEBUG
- printf("transformUnionClause: types are %d -> %d\n", itype, otype);
-#endif
-
/* one or both is a NULL column? then don't convert... */
if (otype == InvalidOid)
{
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.28 1998/09/01 04:30:31 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.29 1998/09/25 13:36:04 thomas Exp $
*
*-------------------------------------------------------------------------
*/
if ((nmatch + nident) == nargs)
return current_candidate->args;
-#ifdef PARSEDEBUG
- printf("func_select_candidate- candidate has %d matches\n", nmatch);
-#endif
if ((nmatch > nbestMatch) || (last_candidate == NULL))
{
nbestMatch = nmatch;
candidates = current_candidate;
last_candidate = current_candidate;
ncandidates = 1;
-#ifdef PARSEDEBUG
- printf("func_select_candidate- choose candidate as best match\n");
-#endif
}
else if (nmatch == nbestMatch)
{
last_candidate->next = current_candidate;
last_candidate = current_candidate;
ncandidates++;
-#ifdef PARSEDEBUG
- printf("func_select_candidate- choose candidate as possible match\n");
-#endif
}
else
{
last_candidate->next = NULL;
-#ifdef PARSEDEBUG
- printf("func_select_candidate- reject candidate as possible match\n");
-#endif
}
}
{
slot_category = current_category;
slot_type = current_type;
-#ifdef PARSEDEBUG
- printf("func_select_candidate- assign column #%d first candidate slot type %s\n",
- i, typeidTypeName(current_type));
-#endif
}
else if ((current_category != slot_category)
&& IS_BUILTIN_TYPE(current_type))
{
-#ifdef PARSEDEBUG
- printf("func_select_candidate- multiple possible types for column #%d; unable to choose candidate\n", i);
-#endif
return NULL;
}
else if (current_type != slot_type)
{
slot_type = current_type;
candidates = current_candidate;
-#ifdef PARSEDEBUG
- printf("func_select_candidate- column #%d found preferred candidate type %s\n",
- i, typeidTypeName(slot_type));
-#endif
}
else
{
-#ifdef PARSEDEBUG
- printf("func_select_candidate- column #%d found possible candidate type %s\n",
- i, typeidTypeName(current_type));
-#endif
}
}
}
if (slot_type != InvalidOid)
{
input_typeids[i] = slot_type;
-#ifdef PARSEDEBUG
- printf("func_select_candidate- assign column #%d slot type %s\n",
- i, typeidTypeName(input_typeids[i]));
-#endif
}
}
else
{
-#ifdef PARSEDEBUG
- printf("func_select_candidate- column #%d input type is %s\n",
- i, typeidTypeName(input_typeids[i]));
-#endif
}
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.21 1998/09/01 04:30:33 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.22 1998/09/25 13:36:05 thomas Exp $
*
*-------------------------------------------------------------------------
*/
Node *result;
Type true_type;
-#ifdef PARSEDEBUG
- printf("make_operand: constructing operand for '%s' %s->%s\n",
- opname, typeidTypeName(orig_typeId), typeidTypeName(true_typeId));
-#endif
if (tree != NULL)
{
result = tree;
/* must coerce? */
if (true_typeId != orig_typeId)
{
-#ifdef PARSEDEBUG
- printf("make_operand: try to convert node from %s to %s\n",
- typeidTypeName(orig_typeId), typeidTypeName(true_typeId));
-#endif
result = coerce_type(NULL, tree, orig_typeId, true_typeId);
}
}
{
rtypeId = (rtree == NULL) ? UNKNOWNOID : exprType(rtree);
tup = left_oper(opname, rtypeId);
-#ifdef PARSEDEBUG
- printf("make_op: returned from left_oper() with structure at %p\n", (void *) tup);
-#endif
opform = (Form_pg_operator) GETSTRUCT(tup);
-#ifdef PARSEDEBUG
- printf("make_op: calling make_operand()\n");
-#endif
right = make_operand(opname, rtree, rtypeId, opform->oprright);
left = NULL;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.18 1998/09/16 14:22:22 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.19 1998/09/25 13:36:07 thomas Exp $
*
*-------------------------------------------------------------------------
*/
nmatch++;
}
-#ifdef PARSEDEBUG
- printf("oper_select_candidate- candidate has %d matches\n", nmatch);
-#endif
if ((nmatch > nbestMatch) || (last_candidate == NULL))
{
nbestMatch = nmatch;
candidates = current_candidate;
last_candidate = current_candidate;
ncandidates = 1;
-#ifdef PARSEDEBUG
- printf("oper_select_candidate- choose candidate as best match\n");
-#endif
}
else if (nmatch == nbestMatch)
{
last_candidate->next = current_candidate;
last_candidate = current_candidate;
ncandidates++;
-#ifdef PARSEDEBUG
- printf("oper_select_candidate- choose candidate as possible match\n");
-#endif
}
else
{
last_candidate->next = NULL;
-#ifdef PARSEDEBUG
- printf("oper_select_candidate- reject candidate as possible match\n");
-#endif
}
}
}
}
-#ifdef PARSEDEBUG
- printf("oper_select_candidate- candidate has %d matches\n", nmatch);
-#endif
if ((nmatch > nbestMatch) || (last_candidate == NULL))
{
nbestMatch = nmatch;
candidates = current_candidate;
last_candidate = current_candidate;
ncandidates = 1;
-#ifdef PARSEDEBUG
- printf("oper_select_candidate- choose candidate as best match\n");
-#endif
}
else if (nmatch == nbestMatch)
{
last_candidate->next = current_candidate;
last_candidate = current_candidate;
ncandidates++;
-#ifdef PARSEDEBUG
- printf("oper_select_candidate- choose candidate as possible match\n");
-#endif
}
else
{
last_candidate->next = NULL;
-#ifdef PARSEDEBUG
- printf("oper_select_candidate- reject candidate as possible match\n");
-#endif
}
}
|| ((nargs > 1) && !can_coerce_type(1, &input_typeids[1], &candidates->args[1])))
{
ncandidates = 0;
-#ifdef PARSEDEBUG
- printf("oper_select_candidate- unable to coerce preferred candidate\n");
-#endif
}
return (ncandidates == 1) ? candidates->args : NULL;
}
{
slot_category = current_category;
slot_type = current_type;
-#ifdef PARSEDEBUG
- printf("oper_select_candidate- assign column #%d first candidate slot type %s\n",
- i, typeidTypeName(current_type));
-#endif
}
else if (current_category != slot_category)
{
-#ifdef PARSEDEBUG
- printf("oper_select_candidate- multiple possible types for column #%d; unable to choose candidate\n", i);
-#endif
return NULL;
}
else if (current_type != slot_type)
{
slot_type = current_type;
candidates = current_candidate;
-#ifdef PARSEDEBUG
- printf("oper_select_candidate- column #%d found preferred candidate type %s\n",
- i, typeidTypeName(slot_type));
-#endif
}
else
{
-#ifdef PARSEDEBUG
- printf("oper_select_candidate- column #%d found possible candidate type %s\n",
- i, typeidTypeName(current_type));
-#endif
}
}
}
if (slot_type != InvalidOid)
{
input_typeids[i] = slot_type;
-#ifdef PARSEDEBUG
- printf("oper_select_candidate- assign column #%d slot type %s\n",
- i, typeidTypeName(input_typeids[i]));
-#endif
}
}
else
{
-#ifdef PARSEDEBUG
- printf("oper_select_candidate- column #%d input type is %s\n",
- i, typeidTypeName(input_typeids[i]));
-#endif
}
}
{
Form_pg_operator opform;
-#if PARSEDEBUG
- printf("oper_exact: found possible commutative operator candidate\n");
-#endif
opform = (Form_pg_operator) GETSTRUCT(tup);
if (opform->oprcom == tup->t_oid)
{
-#if PARSEDEBUG
- printf("oper_exact: commutative operator found\n");
-#endif
if ((ltree != NULL) && (rtree != NULL))
{
tree = *ltree;
ObjectIdGetDatum(candidates->args[1]),
CharGetDatum('b'));
Assert(HeapTupleIsValid(tup));
-
-#if PARSEDEBUG
- printf("oper_inexact: found single candidate\n");
-#endif
-
}
/* Otherwise, multiple operators of the desired types found... */
targetOids = oper_select_candidate(2, inputOids, candidates);
if (targetOids != NULL)
{
-#if PARSEDEBUG
- printf("oper_inexact: found candidate\n");
-#endif
tup = SearchSysCacheTuple(OPRNAME,
PointerGetDatum(op),
ObjectIdGetDatum(targetOids[0]),
fmgr_info(F_CHAREQ, (FmgrInfo *) &opKey[1].sk_func);
opKey[1].sk_argument = CharGetDatum(rightleft);
-#ifdef PARSEDEBUG
- printf("unary_oper_get_candidates: start scan for '%s'\n", op);
-#endif
pg_operator_desc = heap_openr(OperatorRelationName);
pg_operator_scan = heap_beginscan(pg_operator_desc,
0,
current_candidate->args[0] = oper->oprright;
current_candidate->next = *candidates;
*candidates = current_candidate;
-#ifdef PARSEDEBUG
- printf("unary_oper_get_candidates: found candidate '%s' for type %s\n",
- op, typeidTypeName(current_candidate->args[0]));
-#endif
ncandidates++;
}
heap_endscan(pg_operator_scan);
heap_close(pg_operator_desc);
-#ifdef PARSEDEBUG
- printf("unary_oper_get_candidates: found %d candidates\n", ncandidates);
-#endif
return ncandidates;
} /* unary_oper_get_candidates() */
ObjectIdGetDatum(candidates->args[0]),
CharGetDatum('l'));
Assert(HeapTupleIsValid(tup));
-#ifdef PARSEDEBUG
- printf("left_oper: searched cache for single left oper candidate '%s %s'\n",
- op, typeidTypeName((Oid) candidates->args[0]));
-#endif
}
else
{
op, typeidTypeName(arg));
return NULL;
}
-#ifdef PARSEDEBUG
- printf("left_oper: searched cache for best left oper candidate '%s %s'\n",
- op, typeidTypeName(*targetOid));
-#endif
}
}
return (Operator) tup;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.28 1998/09/02 23:05:27 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.29 1998/09/25 13:36:08 thomas Exp $
*
*-------------------------------------------------------------------------
*/
#include "catalog/pg_type.h"
#include "nodes/makefuncs.h"
#include "nodes/primnodes.h"
+#include "nodes/print.h"
#include "parser/parse_expr.h"
#include "parser/parse_func.h"
#include "parser/parse_node.h"
attrtype_target = attnumTypeId(pstate->p_target_relation, resdomno_target);
attrtypmod_target = get_atttypmod(pstate->p_target_relation->rd_id, resdomno_target);
-#ifdef PARSEDEBUG
- printf("MakeTargetEntryIdent- transform type %d to %d\n",
- attrtype_id, attrtype_target);
-#endif
if ((attrtype_id != attrtype_target)
|| ((attrtypmod_target >= 0) && (attrtypmod_target != attrtypmod)))
{
name = ((*resname != NULL) ? *resname : colname);
-#ifdef PARSEDEBUG
- printf("MakeTargetEntryIdent- call transformIdent()\n");
-#endif
#if FALSE
expr = transformIdent(pstate, (Node *) ident, EXPR_COLUMN_FIRST);
#else
else
type_mod = -1;
-#ifdef PARSEDEBUG
- printf("MakeTargetEntryIdent- attrtype_target = %d; type_mod = %d\n", attrtype_target, type_mod);
-#endif
-
tent->resdom = makeResdom((AttrNumber) pstate->p_last_resno++,
(Oid) attrtype_target,
type_mod,
typeidTypeName(type_id));
}
-#ifdef PARSEDEBUG
- printf("MakeTargetEntryExpr: attrtypmod is %d\n", (int4) attrtypmod);
-#endif
-
/*
* Apparently going to a fixed-length string? Then explicitly
* size for storage...
} /* MakeTargetEntryExpr() */
/*
- * MakeTargetlistComplex()
- * pMake a TargetEntry from an complex node.
+ * MakeTargetEntryComplex()
+ * Make a TargetEntry from a complex node.
*/
static TargetEntry *
MakeTargetEntryComplex(ParseState *pstate,
{
Node *expr = transformExpr(pstate, (Node *) res->val, EXPR_COLUMN_FIRST);
-#ifdef PARSEDEBUG
- printf("transformTargetList: decode T_Expr\n");
-#endif
-
handleTargetColname(pstate, &res->name, NULL, NULL);
/* note indirection has not been transformed */
if (pstate->p_is_insert && res->indirection != NIL)
}
/*
- * MakeTargetlistComplex()
- * pMake a TargetEntry from an complex node.
+ * MakeTargetEntryAttr()
+ * Make a TargetEntry from a complex node.
*/
static TargetEntry *
MakeTargetEntryAttr(ParseState *pstate,
/*
* Target item is fully specified: ie. relation.attribute
*/
-#ifdef PARSEDEBUG
- printf("transformTargetList: decode T_Attr\n");
-#endif
result = ParseNestedFuncOrColumn(pstate, att, &pstate->p_last_resno, EXPR_COLUMN_FIRST);
handleTargetColname(pstate, &res->name, att->relname, attrname);
if (att->indirection != NIL)
{
char *identname;
-#ifdef PARSEDEBUG
- printf("transformTargetList: decode T_Ident\n");
-#endif
identname = ((Ident *) res->val)->name;
tent = MakeTargetEntryIdent(pstate, (Node *) res->val, &res->name, NULL, identname, FALSE);
break;
{
if (can_coerce_type(1, &type_id, &attrtype))
{
-#ifdef PARSEDEBUG
- printf("CoerceTargetExpr: coerce type from %s to %s\n",
- typeidTypeName(type_id), typeidTypeName(attrtype));
-#endif
expr = coerce_type(pstate, expr, type_id, attrtype);
}
{
Oid text_id = TEXTOID;
-#ifdef PARSEDEBUG
- printf("CoerceTargetExpr: try coercing from %s to %s via text\n",
- typeidTypeName(type_id), typeidTypeName(attrtype));
-#endif
if (type_id == TEXTOID)
{
}
FuncCall *func;
A_Const *cons;
-#ifdef PARSEDEBUG
- printf("SizeTargetExpr: ensure target fits storage\n");
-#endif
funcname = typeidTypeName(attrtype);
oid_array[0] = attrtype;
oid_array[1] = INT4OID;
for (i = 2; i < 8; i++)
oid_array[i] = InvalidOid;
-#ifdef PARSEDEBUG
- printf("SizeTargetExpr: look for conversion function %s(%s,%s)\n",
- funcname, typeidTypeName(attrtype), typeidTypeName(INT4OID));
-#endif
-
/* attempt to find with arguments exactly as specified... */
ftup = SearchSysCacheTuple(PRONAME,
PointerGetDatum(funcname),
if (HeapTupleIsValid(ftup))
{
-#ifdef PARSEDEBUG
- printf("SizeTargetExpr: found conversion function for sizing\n");
-#endif
func = makeNode(FuncCall);
func->funcname = funcname;
expr = transformExpr(pstate, (Node *) func, EXPR_COLUMN_FIRST);
}
-#ifdef PARSEDEBUG
- else
- printf("SizeTargetExpr: no conversion function for sizing\n");
-#endif
return expr;
} /* SizeTargetExpr() */