Re: Update statement doesn't work

From: David Johnston <polobo(at)yahoo(dot)com>
To: pgadmin-support(at)postgresql(dot)org
Subject: Re: Update statement doesn't work
Date: 2013-09-08 02:21:49
Message-ID: 1378606909676-5770040.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

David Johnston wrote
>
> Mohamedyousof wrote
>> UPDATE "Categories" SET ("Name") = ('test') where "ID" = 28;
> No parenthesis:
>
> UPDATE "Categories" SET "Name" = 'test' WHERE "ID" = 28;
>
> This presumes you truly need the double-quotes. It this does not work try
> removing the double-quotes around "Categories", "Name" and "ID" and see
> what happens.
>
> I am curious why you think the parentheses are necessary. Something in
> the PostgreSQL documentation you've misread; it works (for some reason)
> elsewhere so you simply tried it here as well; or you learned (or just
> guessed) at the syntax incorrectly from some other source?
>
>
> David J.

Note "pgAdmin" is an unusual place to put this question; just because you
use pgAdmin doesn't mean it is the problem. -novice or -general would be a
better place to ask this (probably -novice considering).

Also, the query you got the error on does not match the query you supplied.
Namely you did NOT use double-quote around the word "Name" but simply did:

UPDATE "Category" SET Name = 'test' ....

Because the name column is not quoted it automatically becomes lower-case
and so is equivalent to:

UPDATE "Category" SET name = 'test' ...

and if indeed the column is called "Name" it would not be found when
searching for /name/

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Update-statement-doesn-t-work-tp5770031p5770040.html
Sent from the PostgreSQL - pgadmin support mailing list archive at Nabble.com.

In response to

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message Mohamedyousof 2013-09-08 18:26:47 Re: Update statement doesn't work
Previous Message David Johnston 2013-09-08 02:18:29 Re: Update statement doesn't work