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

Re: PSql won't Let me Set Varchar Column to 'true'

From: Richard Poole <rp(at)guests(dot)deus(dot)net>
To: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: Re: PSql won't Let me Set Varchar Column to 'true'
Date: 2004-08-28 09:54:09
Message-ID: 20040828095408.GB20455@guests.deus.net (view raw or flat)
Thread:
Lists: pgsql-general
On Fri, Aug 27, 2004 at 04:58:08PM -0700, Hunter Hillegas wrote:
> I have two varchars on my table...
> 
> I tried to run the following:
> 
> VMGEngine=# update user_account set editor_status = 'true' and
> administrator_status = 'true' where rec_num = 20;
> ERROR:  column "editor_status" is of type character varying but expression
> is of type boolean
> 
> I was expecting the single quotes to tell psql to treat the data as a
> string, not a constant boolean value.

You're mistaken about the syntax of UPDATE. Assignments should be separated
by commas not by the word 'and', which is a 2-argument operator giving a
boolean result. You want:

update user_account
set editor_status = 'true', administrator_status = 'true'
where rec_num = 20;


Richard

In response to

pgsql-general by date

Next:From: Kaloyan Iliev IlievDate: 2004-08-28 14:23:10
Subject: Functon no longer supported. Why?
Previous:From: Greg StarkDate: 2004-08-28 08:02:15
Subject: Re: Which Order Vacuum Full Analyze Cluster Reindex?

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