Skip to content

Commit

Permalink
Document trigger support.
Browse files Browse the repository at this point in the history
In passing, simplify the check for AFTER triggers with FOR EACH ROW.
  • Loading branch information
Laurenz Albe committed Apr 7, 2014
1 parent ad019c0 commit 2739e10
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions README.oracle_fdw
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,11 @@ The RETURNING clause on INSERT, UPDATE and DELETE is supported except
for columns with Oracle data types LONG and LONG RAW (Oracle doesn't support
these data types in the RETURNING clause).

Triggers on foreign tables are supported from PostgreSQL 9.4.
Triggers defined with AFTER and FOR EACH ROW require that the foreign table
has no columns with Oracle data type LONG or LONG RAW. This is because
such triggers make use of the RETURNING clause mentioned above.

While modifying foreign data works, the performance is not particularly
good, specifically when many rows are affected, because (owing to the way
foreign data wrappers work) each row has to be treated individually.
Expand Down
6 changes: 3 additions & 3 deletions oracle_fdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,9 +661,9 @@ oracleGetForeignRelSize(PlannerInfo *root, RelOptInfo *baserel, Oid foreigntable
rel = heap_open(foreigntableid, NoLock);

/* is there an AFTER trigger FOR EACH ROW? */
has_trigger = (baserel->relid == root->parse->resultRelation)
&& ((root->parse->commandType == CMD_UPDATE && rel->trigdesc && rel->trigdesc->trig_update_after_row)
|| (root->parse->commandType == CMD_DELETE && rel->trigdesc && rel->trigdesc->trig_delete_after_row));
has_trigger = (baserel->relid == root->parse->resultRelation) && rel->trigdesc
&& ((root->parse->commandType == CMD_UPDATE && rel->trigdesc->trig_update_after_row)
|| (root->parse->commandType == CMD_DELETE && rel->trigdesc->trig_delete_after_row));

heap_close(rel, NoLock);

Expand Down

0 comments on commit 2739e10

Please sign in to comment.