Skip to content

Commit 603f601

Browse files
committed
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
1 parent b2c34e2 commit 603f601

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

contrib/dbmirror/README.dbmirror

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ Execute the SQL code in AddTrigger.sql once for each table that should
120120
be mirrored. Replace MyTableName with the name of the table that should
121121
be mirrored.
122122

123+
NOTE: DBMirror requires that every table being mirrored have a primary key
124+
defined.
125+
123126
5) Create the slave database.
124127

125128
The DBMirror system keeps the contents of mirrored tables identical on the

contrib/dbmirror/pending.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/****************************************************************************
22
* pending.c
3-
* $Id: pending.c,v 1.4 2002/09/05 00:43:06 tgl Exp $
3+
* $Id: pending.c,v 1.5 2002/09/26 05:24:30 momjian Exp $
44
*
55
* This file contains a trigger for Postgresql-7.x to record changes to tables
66
* to a pending table for mirroring.
@@ -225,6 +225,11 @@ storeKeyInfo(char *cpTableName, HeapTuple tTupleData,
225225

226226
/* pplan = SPI_saveplan(pplan); */
227227
cpKeyData = packageData(tTupleData, tTupleDesc, tpTrigData, PRIMARY);
228+
if (cpKeyData == NULL)
229+
{
230+
elog(ERROR,"Could not determine primary key data");
231+
return -1;
232+
}
228233
#if defined DEBUG_OUTPUT
229234
elog(NOTICE, cpKeyData);
230235
#endif

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy