Don Isgitt <[EMAIL PROTECTED]> writes:
> Tom Lane wrote:
>> BTW, I find the "limit 1" a bit scary --- if there are multiple matches,
>> this coding will select a random one of them.  Is that really what you
>> want?

> Ah, quite so. Thank you, Tom and Richard for your spot on help. Tom, I 
> appreciate your concern for my limit 1; I confess it is a lazy way out. 
> There are many multiple duplicate entries (oldopr and newopr), so rather 
> than cleaning up the table, ...

Perhaps write the sub-select as

(select distinct newopr from opr_match
 where state=master.state and oldopr=master.operator)

so that you'll get an error if there's more than one value for newopr in
the table.  I'm not sure what performance hit you'll take, but checking
the data for self-consistency is a good idea in my book, especially when
you already know it's not very clean ...

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to