]> granicus.if.org Git - postgresql/blobdiff - src/backend/nodes/outfuncs.c
Support UPDATE/DELETE WHERE CURRENT OF cursor_name, per SQL standard.
[postgresql] / src / backend / nodes / outfuncs.c
index c8cc25abb1330ce9c8cc25d8dd90375bafbf0f6c..869905f0cc548e01b42ecf74f314bbc850b43597 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.300 2007/02/20 17:32:15 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.310 2007/06/11 01:16:22 tgl Exp $
  *
  * NOTES
  *       Every node type that can appear in stored rules' parsetrees *must*
@@ -244,7 +244,10 @@ _outPlannedStmt(StringInfo str, PlannedStmt *node)
        WRITE_NODE_FIELD(planTree);
        WRITE_NODE_FIELD(rtable);
        WRITE_NODE_FIELD(resultRelations);
-       WRITE_NODE_FIELD(into);
+       WRITE_NODE_FIELD(utilityStmt);
+       WRITE_NODE_FIELD(intoClause);
+       WRITE_NODE_FIELD(subplans);
+       WRITE_BITMAPSET_FIELD(rewindPlanIDs);
        WRITE_NODE_FIELD(returningLists);
        WRITE_NODE_FIELD(rowMarks);
        WRITE_INT_FIELD(nParamExec);
@@ -415,6 +418,7 @@ _outSubqueryScan(StringInfo str, SubqueryScan *node)
        _outScanInfo(str, (Scan *) node);
 
        WRITE_NODE_FIELD(subplan);
+       WRITE_NODE_FIELD(subrtable);
 }
 
 static void
@@ -682,6 +686,7 @@ _outConst(StringInfo str, Const *node)
        WRITE_NODE_TYPE("CONST");
 
        WRITE_OID_FIELD(consttype);
+       WRITE_INT_FIELD(consttypmod);
        WRITE_INT_FIELD(constlen);
        WRITE_BOOL_FIELD(constbyval);
        WRITE_BOOL_FIELD(constisnull);
@@ -722,9 +727,9 @@ _outArrayRef(StringInfo str, ArrayRef *node)
 {
        WRITE_NODE_TYPE("ARRAYREF");
 
-       WRITE_OID_FIELD(refrestype);
        WRITE_OID_FIELD(refarraytype);
        WRITE_OID_FIELD(refelemtype);
+       WRITE_INT_FIELD(reftypmod);
        WRITE_NODE_FIELD(refupperindexpr);
        WRITE_NODE_FIELD(reflowerindexpr);
        WRITE_NODE_FIELD(refexpr);
@@ -823,9 +828,8 @@ _outSubPlan(StringInfo str, SubPlan *node)
        WRITE_ENUM_FIELD(subLinkType, SubLinkType);
        WRITE_NODE_FIELD(testexpr);
        WRITE_NODE_FIELD(paramIds);
-       WRITE_NODE_FIELD(plan);
        WRITE_INT_FIELD(plan_id);
-       WRITE_NODE_FIELD(rtable);
+       WRITE_OID_FIELD(firstColType);
        WRITE_BOOL_FIELD(useHashTable);
        WRITE_BOOL_FIELD(unknownEqFalse);
        WRITE_NODE_FIELD(setParam);
@@ -866,6 +870,29 @@ _outRelabelType(StringInfo str, RelabelType *node)
        WRITE_ENUM_FIELD(relabelformat, CoercionForm);
 }
 
+static void
+_outCoerceViaIO(StringInfo str, CoerceViaIO *node)
+{
+       WRITE_NODE_TYPE("COERCEVIAIO");
+
+       WRITE_NODE_FIELD(arg);
+       WRITE_OID_FIELD(resulttype);
+       WRITE_ENUM_FIELD(coerceformat, CoercionForm);
+}
+
+static void
+_outArrayCoerceExpr(StringInfo str, ArrayCoerceExpr *node)
+{
+       WRITE_NODE_TYPE("ARRAYCOERCEEXPR");
+
+       WRITE_NODE_FIELD(arg);
+       WRITE_OID_FIELD(elemfuncid);
+       WRITE_OID_FIELD(resulttype);
+       WRITE_INT_FIELD(resulttypmod);
+       WRITE_BOOL_FIELD(isExplicit);
+       WRITE_ENUM_FIELD(coerceformat, CoercionForm);
+}
+
 static void
 _outConvertRowtypeExpr(StringInfo str, ConvertRowtypeExpr *node)
 {
@@ -1031,6 +1058,15 @@ _outSetToDefault(StringInfo str, SetToDefault *node)
        WRITE_INT_FIELD(typeMod);
 }
 
+static void
+_outCurrentOfExpr(StringInfo str, CurrentOfExpr *node)
+{
+       WRITE_NODE_TYPE("CURRENTOFEXPR");
+
+       WRITE_UINT_FIELD(cvarno);
+       WRITE_STRING_FIELD(cursor_name);
+}
+
 static void
 _outTargetEntry(StringInfo str, TargetEntry *node)
 {
@@ -1259,7 +1295,10 @@ _outPlannerGlobal(StringInfo str, PlannerGlobal *node)
 
        /* NB: this isn't a complete set of fields */
        WRITE_NODE_FIELD(paramlist);
-       WRITE_INT_FIELD(next_plan_id);
+       WRITE_NODE_FIELD(subplans);
+       WRITE_NODE_FIELD(subrtables);
+       WRITE_BITMAPSET_FIELD(rewindPlanIDs);
+       WRITE_NODE_FIELD(finalrtable);
 }
 
 static void
@@ -1317,6 +1356,7 @@ _outRelOptInfo(StringInfo str, RelOptInfo *node)
        WRITE_UINT_FIELD(pages);
        WRITE_FLOAT_FIELD(tuples, "%.0f");
        WRITE_NODE_FIELD(subplan);
+       WRITE_NODE_FIELD(subrtable);
        WRITE_NODE_FIELD(baserestrictinfo);
        WRITE_NODE_FIELD(joininfo);
        WRITE_BOOL_FIELD(has_eclass_joins);
@@ -1419,7 +1459,8 @@ _outInnerIndexscanInfo(StringInfo str, InnerIndexscanInfo *node)
        WRITE_NODE_TYPE("INNERINDEXSCANINFO");
        WRITE_BITMAPSET_FIELD(other_relids);
        WRITE_BOOL_FIELD(isouterjoin);
-       WRITE_NODE_FIELD(best_innerpath);
+       WRITE_NODE_FIELD(cheapest_startup_innerpath);
+       WRITE_NODE_FIELD(cheapest_total_innerpath);
 }
 
 static void
@@ -1431,6 +1472,7 @@ _outOuterJoinInfo(StringInfo str, OuterJoinInfo *node)
        WRITE_BITMAPSET_FIELD(min_righthand);
        WRITE_BOOL_FIELD(is_full_join);
        WRITE_BOOL_FIELD(lhs_strict);
+       WRITE_BOOL_FIELD(delay_upper_joins);
 }
 
 static void
@@ -1499,7 +1541,6 @@ _outIndexStmt(StringInfo str, IndexStmt *node)
        WRITE_NODE_FIELD(indexParams);
        WRITE_NODE_FIELD(options);
        WRITE_NODE_FIELD(whereClause);
-       WRITE_NODE_FIELD(rangetable);
        WRITE_BOOL_FIELD(unique);
        WRITE_BOOL_FIELD(primary);
        WRITE_BOOL_FIELD(isconstraint);
@@ -1530,7 +1571,7 @@ _outSelectStmt(StringInfo str, SelectStmt *node)
        WRITE_NODE_TYPE("SELECT");
 
        WRITE_NODE_FIELD(distinctClause);
-       WRITE_NODE_FIELD(into);
+       WRITE_NODE_FIELD(intoClause);
        WRITE_NODE_FIELD(targetList);
        WRITE_NODE_FIELD(fromClause);
        WRITE_NODE_FIELD(whereClause);
@@ -1675,7 +1716,7 @@ _outQuery(StringInfo str, Query *node)
                appendStringInfo(str, " :utilityStmt <>");
 
        WRITE_INT_FIELD(resultRelation);
-       WRITE_NODE_FIELD(into);
+       WRITE_NODE_FIELD(intoClause);
        WRITE_BOOL_FIELD(hasAggs);
        WRITE_BOOL_FIELD(hasSubLinks);
        WRITE_NODE_FIELD(rtable);
@@ -2143,6 +2184,12 @@ _outNode(StringInfo str, void *obj)
                        case T_RelabelType:
                                _outRelabelType(str, obj);
                                break;
+                       case T_CoerceViaIO:
+                               _outCoerceViaIO(str, obj);
+                               break;
+                       case T_ArrayCoerceExpr:
+                               _outArrayCoerceExpr(str, obj);
+                               break;
                        case T_ConvertRowtypeExpr:
                                _outConvertRowtypeExpr(str, obj);
                                break;
@@ -2191,6 +2238,9 @@ _outNode(StringInfo str, void *obj)
                        case T_SetToDefault:
                                _outSetToDefault(str, obj);
                                break;
+                       case T_CurrentOfExpr:
+                               _outCurrentOfExpr(str, obj);
+                               break;
                        case T_TargetEntry:
                                _outTargetEntry(str, obj);
                                break;