Re: UPDATE Syntax Error

From: "Tim Bruce" <pdxpug(at)tbruce(dot)com>
To: "Rich Shepard" <rshepard(at)appl-ecosys(dot)com>
Cc: pdxpug(at)postgresql(dot)org
Subject: Re: UPDATE Syntax Error
Date: 2011-02-04 20:52:07
Message-ID: 63b13e9353526b463a1ae3b92c63b5ab.squirrel@sm.bruce4.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pdxpug


On Fri, February 4, 2011 12:51, Rich Shepard wrote:
> I _think_ today's the worst cold day and my head will clear from now
> on.
> In the meantime, I'm not seeing why an UPDATE statement does not return
> the
> number of updated rows.
>
> The idea is to replace NULL values in the units column with 'mg/L':
>
> jerrittwq=# update monitor set units = 'mg/L' where units = NULL;
> UPDATE 0
>
> and there should be several thousands of updated rows. I've also tried
> specifying the units attribute as '' and ' ' with no better results.
> Should
> be a simple statement and I'm not seeing why it fails.
>
> FWIW, I tried specifying an alias for the table, but that barfed for a
> different reason:
>
> jerrittwq=# update monitor as m set m.units = 'mg/L' where m.units = NULL;
> ERROR: column "m" of relation "monitor" does not exist
> LINE 1: update monitor as m set m.units = 'mg/L' where m.units = NUL...
>
> Clue stick, please,
>
> Rich
>
> --
> Sent via pdxpug mailing list (pdxpug(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pdxpug
>

Rich,

I believe you want to use units IS NULL; instead of units = NULL; in your
WHERE clause.

Tim
--
Timothy J. Bruce

visit my Website at: http://www.tbruce.com
Registered Linux User #325725

In response to

Responses

Browse pdxpug by date

  From Date Subject
Next Message Darrell Fuhriman 2011-02-04 20:58:14 Re: UPDATE Syntax Error
Previous Message Rich Shepard 2011-02-04 20:51:23 UPDATE Syntax Error