Обсуждение: character varying as boolean !!! help

Поиск
Список
Период
Сортировка

character varying as boolean !!! help

От
"Francesco Andreozzi"
Дата:
I think thi is a bug, I've a lot of db up with same structure and I don't have
any prioblem..
I'm using psql 7.4.2

the problem is that
i've a table

sportellounico=# \d cfp
                                      Tabella "public.cfp"
     Colonna      |       Tipo        |                       Modificatori
------------------+-------------------+----------------------------------------------------------
 cod_cfp          | integer           | not null default
nextval('public.cfp_cod_cfp_seq'::text)
 cod_procedimento | bigint            |
 testo            | character varying |


if I try to insert something it works.... but the update no....

sportellounico=# UPDATE cfp SET testo='test' AND cod_procedimento='82' where
cod_cfp='2';
ERROR:  invalid input syntax for type boolean: "test"

?????????????????

so i've try to update with a boolean value, just for test and offcourse .....

sportellounico=# UPDATE cfp SET testo=true AND cod_procedimento='82' where
cod_cfp='2';
ERROR:  column "testo" is of type character varying but expression is of type
boolean

I've try to drop the field and recreate... but nothing...
any suggestion?

Thankyou Francesco





--
Francesco Andreozzi
Tel. 347-3757481

Re: character varying as boolean !!! help

От
Alvaro Herrera
Дата:
On Thu, Jan 13, 2005 at 12:18:12PM +0100, Francesco Andreozzi wrote:

Hi,

>                                       Tabella "public.cfp"
>      Colonna      |       Tipo        |                       Modificatori
> ------------------+-------------------+----------------------------------------------------------
>  cod_cfp          | integer           | not null default
> nextval('public.cfp_cod_cfp_seq'::text)
>  cod_procedimento | bigint            |
>  testo            | character varying |
>
>
> if I try to insert something it works.... but the update no....
>
> sportellounico=# UPDATE cfp SET testo='test' AND cod_procedimento='82' where
> cod_cfp='2';
> ERROR:  invalid input syntax for type boolean: "test"

Do you have any trigger or rule on this table?

--
Alvaro Herrera (<alvherre[@]dcc.uchile.cl>)
Oh, oh, las chicas galacianas, lo harán por las perlas,
¡Y las de Arrakis por el agua! Pero si buscas damas
Que se consuman como llamas, ¡Prueba una hija de Caladan! (Gurney Halleck)

Re: character varying as boolean !!! help

От
Richard Huxton
Дата:
Francesco Andreozzi wrote:
>
> if I try to insert something it works.... but the update no....
>
> sportellounico=# UPDATE cfp SET testo='test' AND cod_procedimento='82' where
> cod_cfp='2';
> ERROR:  invalid input syntax for type boolean: "test"

The error message is misleading you here. You want a comma not AND
above. The parser is reading that as:

UPDATE cfp SET testo=('test' AND cod_procedimento='82')

--
   Richard Huxton
   Archonet Ltd