COPY should handle after-insert triggers the same as execMain.c does.
authorTom Lane <[email protected]>
Wed, 14 Mar 2001 21:47:50 +0000 (21:47 +0000)
committerTom Lane <[email protected]>
Wed, 14 Mar 2001 21:47:50 +0000 (21:47 +0000)
I'm not sure that it's really necessary to save insert events when there
are only after update or delete triggers, but certainly it's wrong for
COPY to behave differently from an INSERT query.

src/backend/commands/copy.c

index 9a7c8e75ec407d2d78e7d54d128e5fc5d145591c..33c22b8c15148a9a0999d10658c58b69cd4f9c8d 100644 (file)
@@ -877,12 +877,12 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp,
 
                if (!skip_tuple)
                {
+                       ExecStoreTuple(tuple, slot, InvalidBuffer, false);
+
                        /* ----------------
                         * Check the constraints of the tuple
                         * ----------------
                         */
-                       ExecStoreTuple(tuple, slot, InvalidBuffer, false);
-
                        if (rel->rd_att->constr)
                                ExecConstraints("CopyFrom", resultRelInfo, slot, estate);
 
@@ -896,8 +896,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp,
                                ExecInsertIndexTuples(slot, &(tuple->t_self), estate, false);
 
                        /* AFTER ROW INSERT Triggers */
-                       if (rel->trigdesc &&
-                               rel->trigdesc->n_after_row[TRIGGER_EVENT_INSERT] > 0)
+                       if (rel->trigdesc)
                                ExecARInsertTriggers(estate, rel, tuple);
                }