Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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;
> 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:


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

Timothy J. Bruce

visit my Website at:
Registered Linux User #325725

In response to


pdxpug by date

Next:From: Darrell FuhrimanDate: 2011-02-04 20:58:14
Subject: Re: UPDATE Syntax Error
Previous:From: Rich ShepardDate: 2011-02-04 20:51:23
Subject: UPDATE Syntax Error

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group