Skip to content
Snippets Groups Projects
Commit 603f6012 authored by Bruce Momjian's avatar Bruce Momjian
Browse files

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
parent b2c34e2b
No related branches found
No related tags found
No related merge requests found
...@@ -120,6 +120,9 @@ Execute the SQL code in AddTrigger.sql once for each table that should ...@@ -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. Replace MyTableName with the name of the table that should
be mirrored. be mirrored.
NOTE: DBMirror requires that every table being mirrored have a primary key
defined.
5) Create the slave database. 5) Create the slave database.
The DBMirror system keeps the contents of mirrored tables identical on the The DBMirror system keeps the contents of mirrored tables identical on the
......
/**************************************************************************** /****************************************************************************
* pending.c * 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 * This file contains a trigger for Postgresql-7.x to record changes to tables
* to a pending table for mirroring. * to a pending table for mirroring.
...@@ -225,6 +225,11 @@ storeKeyInfo(char *cpTableName, HeapTuple tTupleData, ...@@ -225,6 +225,11 @@ storeKeyInfo(char *cpTableName, HeapTuple tTupleData,
/* pplan = SPI_saveplan(pplan); */ /* pplan = SPI_saveplan(pplan); */
cpKeyData = packageData(tTupleData, tTupleDesc, tpTrigData, PRIMARY); cpKeyData = packageData(tTupleData, tTupleDesc, tpTrigData, PRIMARY);
if (cpKeyData == NULL)
{
elog(ERROR,"Could not determine primary key data");
return -1;
}
#if defined DEBUG_OUTPUT #if defined DEBUG_OUTPUT
elog(NOTICE, cpKeyData); elog(NOTICE, cpKeyData);
#endif #endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment