Return-Path: pg_adm@postgres.berkeley.edu
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA11851; Thu, 17 Sep 92 06:53:28 -0700
Date: Thu, 17 Sep 92 06:53:28 -0700
Message-Id: <9209171353.AA11851@postgres.Berkeley.EDU>
From: neve@nlm.nih.gov (Leif Neve)
Subject: Help me define a rule!
To: postgres@postgres.berkeley.edu
Sender: pg_adm@postgres.berkeley.edu

Folks,

I'm trying to define a rule that says whenever someone
tries to do a REPLACE on a tuple with all the same values,
don't do it.

So I have something like:

	define rule no_dups is \
	on replace to rel where \
	new.attr1=current.attr1 and \
	new.attr2=current.attr1 and \
	... \
	new.attr30=current.attr30 \
	do instead nothing

I need this rule if I want to use PG's time-travel capabilities.
Otherwise, my database gets cluttered up with duplicate records
over the time dimension.

The above strategy works for records with a small number of fields.
However, try it on a record with somewhere over 10 fields and you
get:

	WARN:Sep 17 09:14:08:Tuple is too big: size 10832

I am the farthest thing from a knowledgeable database programmer, so
let me just ask: What is the most natural way to prevent REPLACE's
from going through if they are just replacing duplicate information?
Maybe I'm going about this all wrong?

Leif Neve
