Trigger/Sequence headache - Mailing list pgsql-sql

From Foster, Stephen
Subject Trigger/Sequence headache
Date
Msg-id 000801c63023$8e0af830$2101a8c0@cfgod
Whole thread Raw
Responses Re: Trigger/Sequence headache  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
List pgsql-sql
<div class="Section1"><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">This is going to be one of those stupid problems of mine.<span style="mso-spacerun:yes">  </span>I
havean insert trigger setup to verify that duplicate or repeating information isn’t storage in the table.<span
style="mso-spacerun:yes"> </span>If trigger function finds the information as a duplicate it returns a NULL and the
informationisn’t added; that works.<span style="mso-spacerun:yes">  </span>The problem I’m having is that it is
incrementingthe sequence counter even when the data isn’t added.<span style="mso-spacerun:yes">  </span>Is this
somethingthat I have to live with or should I be returning something other than a NULL?</span></font><p
class="MsoNormal"><fontface="Arial" size="2"><span style="font-size:10.0pt; 
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">I have a function to re-sequence the table and reset the sequence counter in another
application.<spanstyle="mso-spacerun:yes">  </span></span></font><font face="Arial" size="2"><span
style="font-size:10.0pt;font-family:Arial">Normal</span></font><fontface="Arial" size="2"><span
style="font-size:10.0pt;font-family:Arial">for that application because of the constant adding and deleting.<span
style="mso-spacerun:yes"> </span>So if there isn’t another answer then I can write a version of that for this
applicationand run it weekly/monthly depending on need and use.<span style="mso-spacerun:yes">  </span>It just drives
menuts with large holes in the table.</span></font><p class="MsoNormal"><font face="Arial" size="2"><span
style="font-size:10.0pt;
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">Thanks</span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">Lee Foster/</span></font></div>

pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: Very slow updates when using IN syntax subselect
Next
From: Stephan Szabo
Date:
Subject: Re: Trigger/Sequence headache