Re: Update sql question
От | Tom Lane |
---|---|
Тема | Re: Update sql question |
Дата | |
Msg-id | 9645.1118162984@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: Update sql question (Don Isgitt <djisgitt@soundenergy.com>) |
Список | pgsql-general |
Don Isgitt <djisgitt@soundenergy.com> 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
В списке pgsql-general по дате отправления: