| From: | Richard Huxton <dev(at)archonet(dot)com> |
|---|---|
| To: | Don Isgitt <djisgitt(at)soundenergy(dot)com> |
| Cc: | postgresql general <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: Update sql question |
| Date: | 2005-06-07 15:19:37 |
| Message-ID: | 42A5BB09.2050707@archonet.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Don Isgitt wrote:
>
> gds2=# update master set operator=(select
> coalesce(newopr,master.operator) from opr_match where state=master.state
> and oldopr=master.operator limit 1) where state='NM' and operator is not
> null;
> What am I doing wrong that gives me the 261 null operator fields after
> the update?
Hmm - haven't tested this, but what would happen if the subselect
returned no matches? Quickest test is probably to add a dummy value to
the coalesce and see if that takes the place of the 261 nulls. If it
doesn't, the subselect isn't matching for those rows.
--
Richard Huxton
Archonet Ltd
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2005-06-07 15:20:54 | Re: pg_dump 8.0.3 failing against PostgreSQL 7.3.2 |
| Previous Message | Robert Fitzpatrick | 2005-06-07 15:17:52 | Password authentication failed for user |