Trigger/Sequence headache
От | Foster, Stephen |
---|---|
Тема | Trigger/Sequence headache |
Дата | |
Msg-id | 000801c63023$8e0af830$2101a8c0@cfgod обсуждение исходный текст |
Ответы |
Re: Trigger/Sequence headache
|
Список | 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 по дате отправления: