* Portions Copyright (c) 2000-2001, PostgreSQL Global Development Group
* Copyright 1999 Jan Wieck
*
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.33 2002/03/19 02:57:15 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.34 2002/04/01 02:02:34 tgl Exp $
*
* ----------
*/
#include "catalog/pg_operator.h"
#include "commands/trigger.h"
#include "executor/spi_priv.h"
+#include "nodes/makefuncs.h"
#include "miscadmin.h"
static void ri_HashPreparedPlan(RI_QueryKey *key, void *plan);
+/*
+ * very ugly, very temporary hack to allow RI triggers to find tables
+ * anywhere in the current search path. This is just so that the regression
+ * tests don't break with new search path code; we MUST find a more bullet
+ * proof solution before release.
+ */
+static Relation
+kluge_openr(char *relationName, LOCKMODE lockmode)
+{
+ return heap_openrv(makeRangeVar(NULL, relationName), lockmode);
+}
+
/* ----------
* RI_FKey_check -
* tuple.
*/
fk_rel = trigdata->tg_relation;
- pk_rel = heap_openr(tgargs[RI_PK_RELNAME_ARGNO], NoLock);
+ pk_rel = kluge_openr(tgargs[RI_PK_RELNAME_ARGNO], NoLock);
if (TRIGGER_FIRED_BY_UPDATE(trigdata->tg_event))
{
old_row = trigdata->tg_trigtuple;
* Get the relation descriptors of the FK and PK tables and the old
* tuple.
*/
- fk_rel = heap_openr(tgargs[RI_FK_RELNAME_ARGNO], NoLock);
+ fk_rel = kluge_openr(tgargs[RI_FK_RELNAME_ARGNO], NoLock);
pk_rel = trigdata->tg_relation;
old_row = trigdata->tg_trigtuple;
* Get the relation descriptors of the FK and PK tables and the new
* and old tuple.
*/
- fk_rel = heap_openr(tgargs[RI_FK_RELNAME_ARGNO], NoLock);
+ fk_rel = kluge_openr(tgargs[RI_FK_RELNAME_ARGNO], NoLock);
pk_rel = trigdata->tg_relation;
new_row = trigdata->tg_newtuple;
old_row = trigdata->tg_trigtuple;
* Get the relation descriptors of the FK and PK tables and the old
* tuple.
*/
- fk_rel = heap_openr(tgargs[RI_FK_RELNAME_ARGNO], NoLock);
+ fk_rel = kluge_openr(tgargs[RI_FK_RELNAME_ARGNO], NoLock);
fk_owner = RelationGetForm(fk_rel)->relowner;
pk_rel = trigdata->tg_relation;
old_row = trigdata->tg_trigtuple;
* Get the relation descriptors of the FK and PK tables and the new
* and old tuple.
*/
- fk_rel = heap_openr(tgargs[RI_FK_RELNAME_ARGNO], NoLock);
+ fk_rel = kluge_openr(tgargs[RI_FK_RELNAME_ARGNO], NoLock);
fk_owner = RelationGetForm(fk_rel)->relowner;
pk_rel = trigdata->tg_relation;
new_row = trigdata->tg_newtuple;
* Get the relation descriptors of the FK and PK tables and the old
* tuple.
*/
- fk_rel = heap_openr(tgargs[RI_FK_RELNAME_ARGNO], NoLock);
+ fk_rel = kluge_openr(tgargs[RI_FK_RELNAME_ARGNO], NoLock);
fk_owner = RelationGetForm(fk_rel)->relowner;
pk_rel = trigdata->tg_relation;
old_row = trigdata->tg_trigtuple;
* Get the relation descriptors of the FK and PK tables and the new
* and old tuple.
*/
- fk_rel = heap_openr(tgargs[RI_FK_RELNAME_ARGNO], NoLock);
+ fk_rel = kluge_openr(tgargs[RI_FK_RELNAME_ARGNO], NoLock);
fk_owner = RelationGetForm(fk_rel)->relowner;
pk_rel = trigdata->tg_relation;
new_row = trigdata->tg_newtuple;
* Get the relation descriptors of the FK and PK tables and the old
* tuple.
*/
- fk_rel = heap_openr(tgargs[RI_FK_RELNAME_ARGNO], NoLock);
+ fk_rel = kluge_openr(tgargs[RI_FK_RELNAME_ARGNO], NoLock);
fk_owner = RelationGetForm(fk_rel)->relowner;
pk_rel = trigdata->tg_relation;
old_row = trigdata->tg_trigtuple;
* Get the relation descriptors of the FK and PK tables and the old
* tuple.
*/
- fk_rel = heap_openr(tgargs[RI_FK_RELNAME_ARGNO], NoLock);
+ fk_rel = kluge_openr(tgargs[RI_FK_RELNAME_ARGNO], NoLock);
fk_owner = RelationGetForm(fk_rel)->relowner;
pk_rel = trigdata->tg_relation;
new_row = trigdata->tg_newtuple;
* Get the relation descriptors of the FK and PK tables and the old
* tuple.
*/
- fk_rel = heap_openr(tgargs[RI_FK_RELNAME_ARGNO], NoLock);
+ fk_rel = kluge_openr(tgargs[RI_FK_RELNAME_ARGNO], NoLock);
fk_owner = RelationGetForm(fk_rel)->relowner;
pk_rel = trigdata->tg_relation;
old_row = trigdata->tg_trigtuple;
* Get the relation descriptors of the FK and PK tables and the old
* tuple.
*/
- fk_rel = heap_openr(tgargs[RI_FK_RELNAME_ARGNO], NoLock);
+ fk_rel = kluge_openr(tgargs[RI_FK_RELNAME_ARGNO], NoLock);
fk_owner = RelationGetForm(fk_rel)->relowner;
pk_rel = trigdata->tg_relation;
new_row = trigdata->tg_newtuple;
* Get the relation descriptors of the FK and PK tables and the new
* and old tuple.
*/
- fk_rel = heap_openr(tgargs[RI_FK_RELNAME_ARGNO], NoLock);
+ fk_rel = kluge_openr(tgargs[RI_FK_RELNAME_ARGNO], NoLock);
pk_rel = trigdata->tg_relation;
new_row = trigdata->tg_newtuple;
old_row = trigdata->tg_trigtuple;