Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ee88006

Browse files
author
Thomas G. Lockhart
committed
Clean up code in analyze.c for SERIAL data type.
Remove _all_ PARSEDEBUG print statements.
1 parent 2df1465 commit ee88006

File tree

7 files changed

+18
-236
lines changed

7 files changed

+18
-236
lines changed

src/backend/parser/analyze.c

+7-11
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.87 1998/09/16 14:25:37 thomas Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.88 1998/09/25 13:36:00 thomas Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -30,9 +30,6 @@
3030
#include "parser/parse_target.h"
3131
#include "utils/builtins.h"
3232
#include "utils/mcxt.h"
33-
#ifdef PARSEDEBUG
34-
#include "nodes/print.h"
35-
#endif
3633

3734
static Query *transformStmt(ParseState *pstate, Node *stmt);
3835
static Query *transformDeleteStmt(ParseState *pstate, DeleteStmt *stmt);
@@ -68,10 +65,6 @@ parse_analyze(List *pl, ParseState *parentParseState)
6865

6966
while (pl != NIL)
7067
{
71-
#ifdef PARSEDEBUG
72-
elog(DEBUG, "parse tree from yacc:\n---\n%s\n---\n", nodeToString(lfirst(pl)));
73-
#endif
74-
7568
pstate = make_parsestate(parentParseState);
7669
result->qtrees[i++] = transformStmt(pstate, lfirst(pl));
7770
if (pstate->p_target_relation != NULL)
@@ -517,12 +510,15 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
517510

518511
if (column->is_sequence)
519512
{
520-
char *cstring;
513+
char *sname;
514+
char *cstring;
521515
CreateSeqStmt *sequence;
522516

517+
sname = makeTableName(stmt->relname, column->colname, "seq", NULL);
518+
523519
constraint = makeNode(Constraint);
524520
constraint->contype = CONSTR_DEFAULT;
525-
constraint->name = makeTableName(stmt->relname, column->colname, "seq", NULL);
521+
constraint->name = sname;
526522
cstring = palloc(9 + strlen(constraint->name) + 2 + 1);
527523
strcpy(cstring, "nextval('");
528524
strcat(cstring, constraint->name);
@@ -551,7 +547,7 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
551547
}
552548

553549
sequence = makeNode(CreateSeqStmt);
554-
sequence->seqname = pstrdup(constraint->name);
550+
sequence->seqname = pstrdup(sname);
555551
sequence->options = NIL;
556552

557553
elog(NOTICE, "CREATE TABLE will create implicit sequence %s for SERIAL column %s.%s",

src/backend/parser/gram.y

+1-14
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.31 1998/09/16 14:29:35 thomas Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.32 1998/09/25 13:36:01 thomas Exp $
1414
*
1515
* HISTORY
1616
* AUTHOR DATE MAJOR EVENT
@@ -5024,10 +5024,6 @@ FlattenStringList(List *list)
50245024
};
50255025
*(s+len) = '\0';
50265026

5027-
#ifdef PARSEDEBUG
5028-
elog(DEBUG, "flattened string is \"%s\"\n", s);
5029-
#endif
5030-
50315027
return s;
50325028
} /* FlattenStringList() */
50335029

@@ -5075,10 +5071,6 @@ makeConstantList( A_Const *n)
50755071
elog(ERROR,"Internal error in makeConstantList(): cannot encode node");
50765072
};
50775073

5078-
#ifdef PARSEDEBUG
5079-
elog(DEBUG, "AexprConst argument is \"%s\"\n", defval);
5080-
#endif
5081-
50825074
return result;
50835075
} /* makeConstantList() */
50845076

@@ -5104,11 +5096,6 @@ fmtId(char *rawid)
51045096
cp = rawid;
51055097
};
51065098

5107-
#ifdef PARSEDEBUG
5108-
elog(DEBUG, "fmtId- %sconvert %s to %s\n",
5109-
((cp == rawid)? "do not ": ""), rawid, cp);
5110-
#endif
5111-
51125099
return cp;
51135100
}
51145101

src/backend/parser/parse_clause.c

+1-24
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.25 1998/09/01 04:30:27 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.26 1998/09/25 13:36:03 thomas Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -389,10 +389,6 @@ transformSortClause(ParseState *pstate,
389389
{
390390
List *s = NIL;
391391

392-
#ifdef PARSEDEBUG
393-
printf("transformSortClause: entering\n");
394-
#endif
395-
396392
while (orderlist != NIL)
397393
{
398394
SortGroupBy *sortby = lfirst(orderlist);
@@ -402,11 +398,6 @@ transformSortClause(ParseState *pstate,
402398

403399
restarget = findTargetlistEntry(pstate, sortby->node, targetlist, ORDER_CLAUSE);
404400

405-
#ifdef PARSEDEBUG
406-
printf("transformSortClause: find sorting operator for type %d\n",
407-
restarget->resdom->restype);
408-
#endif
409-
410401
sortcl->resdom = resdom = restarget->resdom;
411402

412403
/*
@@ -478,11 +469,6 @@ transformSortClause(ParseState *pstate,
478469
/* not a member of the sortclauses yet */
479470
SortClause *sortcl = makeNode(SortClause);
480471

481-
#ifdef PARSEDEBUG
482-
printf("transformSortClause: (2) find sorting operator for type %d\n",
483-
tlelt->resdom->restype);
484-
#endif
485-
486472
if (tlelt->resdom->restype == InvalidOid)
487473
tlelt->resdom->restype = INT4OID;
488474

@@ -520,11 +506,6 @@ transformSortClause(ParseState *pstate,
520506
/* not a member of the sortclauses yet */
521507
SortClause *sortcl = makeNode(SortClause);
522508

523-
#ifdef PARSEDEBUG
524-
printf("transformSortClause: try sorting type %d\n",
525-
tlelt->resdom->restype);
526-
#endif
527-
528509
sortcl->resdom = tlelt->resdom;
529510
sortcl->opoid = any_ordering_op(tlelt->resdom->restype);
530511

@@ -576,10 +557,6 @@ transformUnionClause(List *unionClause, List *targetlist)
576557
otype = ((TargetEntry *) lfirst(prev_target))->resdom->restype;
577558
itype = ((TargetEntry *) lfirst(next_target))->resdom->restype;
578559

579-
#ifdef PARSEDEBUG
580-
printf("transformUnionClause: types are %d -> %d\n", itype, otype);
581-
#endif
582-
583560
/* one or both is a NULL column? then don't convert... */
584561
if (otype == InvalidOid)
585562
{

src/backend/parser/parse_func.c

+1-36
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.28 1998/09/01 04:30:31 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.29 1998/09/25 13:36:04 thomas Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -672,34 +672,22 @@ func_select_candidate(int nargs,
672672
if ((nmatch + nident) == nargs)
673673
return current_candidate->args;
674674

675-
#ifdef PARSEDEBUG
676-
printf("func_select_candidate- candidate has %d matches\n", nmatch);
677-
#endif
678675
if ((nmatch > nbestMatch) || (last_candidate == NULL))
679676
{
680677
nbestMatch = nmatch;
681678
candidates = current_candidate;
682679
last_candidate = current_candidate;
683680
ncandidates = 1;
684-
#ifdef PARSEDEBUG
685-
printf("func_select_candidate- choose candidate as best match\n");
686-
#endif
687681
}
688682
else if (nmatch == nbestMatch)
689683
{
690684
last_candidate->next = current_candidate;
691685
last_candidate = current_candidate;
692686
ncandidates++;
693-
#ifdef PARSEDEBUG
694-
printf("func_select_candidate- choose candidate as possible match\n");
695-
#endif
696687
}
697688
else
698689
{
699690
last_candidate->next = NULL;
700-
#ifdef PARSEDEBUG
701-
printf("func_select_candidate- reject candidate as possible match\n");
702-
#endif
703691
}
704692
}
705693

@@ -727,17 +715,10 @@ func_select_candidate(int nargs,
727715
{
728716
slot_category = current_category;
729717
slot_type = current_type;
730-
#ifdef PARSEDEBUG
731-
printf("func_select_candidate- assign column #%d first candidate slot type %s\n",
732-
i, typeidTypeName(current_type));
733-
#endif
734718
}
735719
else if ((current_category != slot_category)
736720
&& IS_BUILTIN_TYPE(current_type))
737721
{
738-
#ifdef PARSEDEBUG
739-
printf("func_select_candidate- multiple possible types for column #%d; unable to choose candidate\n", i);
740-
#endif
741722
return NULL;
742723
}
743724
else if (current_type != slot_type)
@@ -746,36 +727,20 @@ func_select_candidate(int nargs,
746727
{
747728
slot_type = current_type;
748729
candidates = current_candidate;
749-
#ifdef PARSEDEBUG
750-
printf("func_select_candidate- column #%d found preferred candidate type %s\n",
751-
i, typeidTypeName(slot_type));
752-
#endif
753730
}
754731
else
755732
{
756-
#ifdef PARSEDEBUG
757-
printf("func_select_candidate- column #%d found possible candidate type %s\n",
758-
i, typeidTypeName(current_type));
759-
#endif
760733
}
761734
}
762735
}
763736

764737
if (slot_type != InvalidOid)
765738
{
766739
input_typeids[i] = slot_type;
767-
#ifdef PARSEDEBUG
768-
printf("func_select_candidate- assign column #%d slot type %s\n",
769-
i, typeidTypeName(input_typeids[i]));
770-
#endif
771740
}
772741
}
773742
else
774743
{
775-
#ifdef PARSEDEBUG
776-
printf("func_select_candidate- column #%d input type is %s\n",
777-
i, typeidTypeName(input_typeids[i]));
778-
#endif
779744
}
780745
}
781746

src/backend/parser/parse_node.c

+1-15
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.21 1998/09/01 04:30:33 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.22 1998/09/25 13:36:05 thomas Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -67,10 +67,6 @@ make_operand(char *opname,
6767
Node *result;
6868
Type true_type;
6969

70-
#ifdef PARSEDEBUG
71-
printf("make_operand: constructing operand for '%s' %s->%s\n",
72-
opname, typeidTypeName(orig_typeId), typeidTypeName(true_typeId));
73-
#endif
7470
if (tree != NULL)
7571
{
7672
result = tree;
@@ -80,10 +76,6 @@ make_operand(char *opname,
8076
/* must coerce? */
8177
if (true_typeId != orig_typeId)
8278
{
83-
#ifdef PARSEDEBUG
84-
printf("make_operand: try to convert node from %s to %s\n",
85-
typeidTypeName(orig_typeId), typeidTypeName(true_typeId));
86-
#endif
8779
result = coerce_type(NULL, tree, orig_typeId, true_typeId);
8880
}
8981
}
@@ -155,13 +147,7 @@ make_op(char *opname, Node *ltree, Node *rtree)
155147
{
156148
rtypeId = (rtree == NULL) ? UNKNOWNOID : exprType(rtree);
157149
tup = left_oper(opname, rtypeId);
158-
#ifdef PARSEDEBUG
159-
printf("make_op: returned from left_oper() with structure at %p\n", (void *) tup);
160-
#endif
161150
opform = (Form_pg_operator) GETSTRUCT(tup);
162-
#ifdef PARSEDEBUG
163-
printf("make_op: calling make_operand()\n");
164-
#endif
165151
right = make_operand(opname, rtree, rtypeId, opform->oprright);
166152
left = NULL;
167153

0 commit comments

Comments
 (0)