Defend against 'update oid'. Someday we might want to support
authorTom Lane
Thu, 29 Apr 1999 03:01:50 +0000 (03:01 +0000)
committerTom Lane
Thu, 29 Apr 1999 03:01:50 +0000 (03:01 +0000)
that, but it'd be a New Feature, wouldn't it ... in the meantime,
avoiding a backend crash seems worthwhile.

src/backend/parser/parse_target.c

index b2a2af64ad849b134d51d029186d1159479d5e75..b2376054fcab30eb8920749be62e49012c7a60f4 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.34 1999/02/03 21:16:59 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.35 1999/04/29 03:01:50 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -216,6 +216,8 @@ MakeTargetEntryExpr(ParseState *pstate,
        rd = pstate->p_target_relation;
        Assert(rd != NULL);
        resdomno = attnameAttNum(rd, colname);
+       if (resdomno <= 0)
+           elog(ERROR, "Cannot assign to system attribute '%s'", colname);
        attrisset = attnameIsSet(rd, colname);
        attrtype = attnumTypeId(rd, resdomno);
        if ((arrayRef != NIL) && (lfirst(arrayRef) == NIL))