<br /> Is there anyway way to get the following to work?<br /><br /><font face="Courier, Courier">table foo<br /> id |
name1 | name2<br /> ---+---------+------<br /> 0 | Abe | NULL<br /> 1 | William | Bill<br /><br /><br
/></font>createfunction prefname(text, text)<br /> returns text as'<br /> declare<br /> name1 alias for $1;<br
/> name2 alias for $2;<br /> begin<br /> if name2 isnull<br /> then<br /> return
name1;<br/> else<br /> return name2;<br /> end if;<br /> end;'<br /> language
'plpgsql';<br/> <br /> if I do<br /> select id, name1, name2, prefname(name1, name2) as pref from foo;<br /><br /> I
windup with <br /><br /><font face="Courier, Courier">id | name1 | name2 | prefname<br />
---+---------+-------+-----------<br/> 0 | Abe | NULL | NULL<br /> 1 | William | Bill | Bill<br /><br
/></font>insteadof <br /><br /><font face="Courier, Courier">id | name1 | name2 | prefname<br />
---+---------+-------+-----------<br/> 0 | Abe | NULL | Abe<br /> 1 | William | Bill | Bill<br /><br /></font>
Iassume this has to do with Postgres not executing the function is one of the arguments is missing...<br /><br /><br />
-<br /> - <b><u>Thomas Swan</u></b> <br /> - Graduate Student - Computer Science<br
/>- The University of Mississippi<br /> - <br /> - "People can be categorized into two fundamental <br /> - groups,
thosethat divide people into two groups <br /> - and those that don't."