Update question - Mailing list pgsql-sql

From Fay Du
Subject Update question
Date
Msg-id 00b801c65286$7ca8f260$b8d849c6@versaterm.com
Whole thread Raw
Responses Re: Update question
List pgsql-sql
<div class="Section1"><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">Hi all:</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">I have a table like this:</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">Table cost</span></font><p class="MsoNormal"><span class="GramE"><font face="Arial" size="2"><span
style="font-size:10.0pt;font-family:Arial">Id<span style="mso-spacerun:yes"> </span><span
class="SpellE">edge</span></span></font></span><spanclass="SpellE"><font face="Arial" size="2"><span
style="font-size:10.0pt;font-family:
Arial">_id</span></font></span><font face="Arial" size="2"><span style="font-size:
10.0pt;font-family:Arial"><span style="mso-spacerun:yes">  </span><span
style="mso-spacerun:yes">  </span>cost</span></font><pclass="MsoNormal"><font face="Arial" size="2"><span
style="font-size:10.0pt;
font-family:Arial">1<span style="mso-spacerun:yes">       </span>30<span style="mso-spacerun:yes">        
</span>101.4</span></font><pclass="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; 
font-family:Arial">2<span style="mso-spacerun:yes">       </span>30<span style="mso-spacerun:yes">         
</span>null</span></font><pclass="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; 
font-family:Arial">3<span style="mso-spacerun:yes">       </span>40<span style="mso-spacerun:yes">         
</span>500.2</span></font><pclass="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; 
font-family:Arial">4<span style="mso-spacerun:yes">       </span>40<span style="mso-spacerun:yes">          
</span>null</span></font><pclass="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; 
font-family:Arial">5<span style="mso-spacerun:yes">        </span>45<span style="mso-spacerun:yes">         
</span>300.7</span></font><pclass="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; 
font-family:Arial">6<span style="mso-spacerun:yes">        </span>45<span style="mso-spacerun:yes">          
</span>null</span></font><pclass="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">I want to set cost value with same <span class="SpellE">edge_id</span> by same value. The existing
valuesare calculated by calling a function (calculate edge length). I can calculate the value by same function, but the
functionwas slow. I wander if I can use update statement to set the second value with same <span
class="SpellE">edge_id</span>.Thanks in advance for your help.</span></font><p class="MsoNormal"><font face="Arial"
size="2"><spanstyle="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">Fay</span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial"> </span></font></div>

pgsql-sql by date:

Previous
From: Wiebe Cazemier
Date:
Subject: Re: cursor and for update
Next
From: Markus Schaber
Date:
Subject: Re: Update question