aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2002-09-26 05:24:30 +0000
committerBruce Momjian <bruce@momjian.us>2002-09-26 05:24:30 +0000
commit603f601269ebba85477ea5fbd16f8295da585625 (patch)
treeb1729d1a2cbedcca7790e9c10f049cb441393636
parentb2c34e2bd1f48fe3aa1c9e5365e1eca9b0748b64 (diff)
downloadpostgresql-603f601269ebba85477ea5fbd16f8295da585625.tar.gz
postgresql-603f601269ebba85477ea5fbd16f8295da585625.zip
Attached is a patch to contrib/dbmirror that fixes a bug that was
causing the postmaster to crash when the trigger was running on a table without a primary key. I've also updated the docs to explicitly say that tables need primary keys. Steven Singer
-rw-r--r--contrib/dbmirror/README.dbmirror3
-rw-r--r--contrib/dbmirror/pending.c7
2 files changed, 9 insertions, 1 deletions
diff --git a/contrib/dbmirror/README.dbmirror b/contrib/dbmirror/README.dbmirror
index 8788ffd4e5f..b89ea49a94f 100644
--- a/contrib/dbmirror/README.dbmirror
+++ b/contrib/dbmirror/README.dbmirror
@@ -120,6 +120,9 @@ Execute the SQL code in AddTrigger.sql once for each table that should
be mirrored. Replace MyTableName with the name of the table that should
be mirrored.
+NOTE: DBMirror requires that every table being mirrored have a primary key
+defined.
+
5) Create the slave database.
The DBMirror system keeps the contents of mirrored tables identical on the
diff --git a/contrib/dbmirror/pending.c b/contrib/dbmirror/pending.c
index d62da430d19..911cd7ab47f 100644
--- a/contrib/dbmirror/pending.c
+++ b/contrib/dbmirror/pending.c
@@ -1,6 +1,6 @@
/****************************************************************************
* pending.c
- * $Id: pending.c,v 1.4 2002/09/05 00:43:06 tgl Exp $
+ * $Id: pending.c,v 1.5 2002/09/26 05:24:30 momjian Exp $
*
* This file contains a trigger for Postgresql-7.x to record changes to tables
* to a pending table for mirroring.
@@ -225,6 +225,11 @@ storeKeyInfo(char *cpTableName, HeapTuple tTupleData,
/* pplan = SPI_saveplan(pplan); */
cpKeyData = packageData(tTupleData, tTupleDesc, tpTrigData, PRIMARY);
+ if (cpKeyData == NULL)
+ {
+ elog(ERROR,"Could not determine primary key data");
+ return -1;
+ }
#if defined DEBUG_OUTPUT
elog(NOTICE, cpKeyData);
#endif