aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2001-11-12 06:09:09 +0000
committerBruce Momjian <bruce@momjian.us>2001-11-12 06:09:09 +0000
commite506ca40634b0e893ea888aaf18896cab309f704 (patch)
tree1c9e569092a0c9d6e005c1e78a11e1150bf2b6b9
parent9371325042a21cd5369d5efcb592f2b9de685441 (diff)
downloadpostgresql-e506ca40634b0e893ea888aaf18896cab309f704.tar.gz
postgresql-e506ca40634b0e893ea888aaf18896cab309f704.zip
Tables without oids wouldn't be able to be
used inside fk constraints, since some of the checks in the trigger did a SELECT oid. Since the oid wasn't actually used, I changed this to SELECT 1. My test case with non-oid tables now works and fk regression appears to run fine on my machine. Stephan Szabo
-rw-r--r--src/backend/utils/adt/ri_triggers.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c
index 071b7248d88..6fcc8142526 100644
--- a/src/backend/utils/adt/ri_triggers.c
+++ b/src/backend/utils/adt/ri_triggers.c
@@ -18,7 +18,7 @@
* 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.30 2001/11/12 00:46:36 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.31 2001/11/12 06:09:09 momjian Exp $
*
* ----------
*/
@@ -232,10 +232,10 @@ RI_FKey_check(PG_FUNCTION_ARGS)
/* ---------
* The query string built is
- * SELECT oid FROM ONLY <pktable>
+ * SELECT 1 FROM ONLY <pktable>
* ----------
*/
- sprintf(querystr, "SELECT oid FROM ONLY \"%s\" FOR UPDATE OF \"%s\"",
+ sprintf(querystr, "SELECT 1 FROM ONLY \"%s\" FOR UPDATE OF \"%s\"",
tgargs[RI_PK_RELNAME_ARGNO],
tgargs[RI_PK_RELNAME_ARGNO]);
@@ -376,14 +376,14 @@ RI_FKey_check(PG_FUNCTION_ARGS)
/* ----------
* The query string built is
- * SELECT oid FROM ONLY <pktable> WHERE pkatt1 = $1 [AND ...]
+ * SELECT 1 FROM ONLY <pktable> WHERE pkatt1 = $1 [AND ...]
* The type id's for the $ parameters are those of the
* corresponding FK attributes. Thus, SPI_prepare could
* eventually fail if the parser cannot identify some way
* how to compare these two types by '='.
* ----------
*/
- sprintf(querystr, "SELECT oid FROM ONLY \"%s\"",
+ sprintf(querystr, "SELECT 1 FROM ONLY \"%s\"",
tgargs[RI_PK_RELNAME_ARGNO]);
querysep = "WHERE";
for (i = 0; i < qkey.nkeypairs; i++)
@@ -609,14 +609,14 @@ RI_FKey_noaction_del(PG_FUNCTION_ARGS)
/* ----------
* The query string built is
- * SELECT oid FROM ONLY <fktable> WHERE fkatt1 = $1 [AND ...]
+ * SELECT 1 FROM ONLY <fktable> WHERE fkatt1 = $1 [AND ...]
* The type id's for the $ parameters are those of the
* corresponding PK attributes. Thus, SPI_prepare could
* eventually fail if the parser cannot identify some way
* how to compare these two types by '='.
* ----------
*/
- sprintf(querystr, "SELECT oid FROM ONLY \"%s\"",
+ sprintf(querystr, "SELECT 1 FROM ONLY \"%s\"",
tgargs[RI_FK_RELNAME_ARGNO]);
querysep = "WHERE";
for (i = 0; i < qkey.nkeypairs; i++)
@@ -823,14 +823,14 @@ RI_FKey_noaction_upd(PG_FUNCTION_ARGS)
/* ----------
* The query string built is
- * SELECT oid FROM ONLY <fktable> WHERE fkatt1 = $1 [AND ...]
+ * SELECT 1 FROM ONLY <fktable> WHERE fkatt1 = $1 [AND ...]
* The type id's for the $ parameters are those of the
* corresponding PK attributes. Thus, SPI_prepare could
* eventually fail if the parser cannot identify some way
* how to compare these two types by '='.
* ----------
*/
- sprintf(querystr, "SELECT oid FROM ONLY \"%s\"",
+ sprintf(querystr, "SELECT 1 FROM ONLY \"%s\"",
tgargs[RI_FK_RELNAME_ARGNO]);
querysep = "WHERE";
for (i = 0; i < qkey.nkeypairs; i++)
@@ -1450,14 +1450,14 @@ RI_FKey_restrict_del(PG_FUNCTION_ARGS)
/* ----------
* The query string built is
- * SELECT oid FROM ONLY <fktable> WHERE fkatt1 = $1 [AND ...]
+ * SELECT 1 FROM ONLY <fktable> WHERE fkatt1 = $1 [AND ...]
* The type id's for the $ parameters are those of the
* corresponding PK attributes. Thus, SPI_prepare could
* eventually fail if the parser cannot identify some way
* how to compare these two types by '='.
* ----------
*/
- sprintf(querystr, "SELECT oid FROM ONLY \"%s\"",
+ sprintf(querystr, "SELECT 1 FROM ONLY \"%s\"",
tgargs[RI_FK_RELNAME_ARGNO]);
querysep = "WHERE";
for (i = 0; i < qkey.nkeypairs; i++)
@@ -1670,14 +1670,14 @@ RI_FKey_restrict_upd(PG_FUNCTION_ARGS)
/* ----------
* The query string built is
- * SELECT oid FROM ONLY <fktable> WHERE fkatt1 = $1 [AND ...]
+ * SELECT 1 FROM ONLY <fktable> WHERE fkatt1 = $1 [AND ...]
* The type id's for the $ parameters are those of the
* corresponding PK attributes. Thus, SPI_prepare could
* eventually fail if the parser cannot identify some way
* how to compare these two types by '='.
* ----------
*/
- sprintf(querystr, "SELECT oid FROM ONLY \"%s\"",
+ sprintf(querystr, "SELECT 1 FROM ONLY \"%s\"",
tgargs[RI_FK_RELNAME_ARGNO]);
querysep = "WHERE";
for (i = 0; i < qkey.nkeypairs; i++)