Re: now i'm really confused. insert/update does autocast, where sometimes.

From: Daniel Schuchardt <daniel_schuchardt(at)web(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: now i'm really confused. insert/update does autocast, where sometimes.
Date: 2008-05-06 09:56:17
Message-ID: fvpa00$31fb$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

demo=# ALTER TABLE a ADD COLUMN d VARCHAR;
ALTER TABLE
demo=# UPDATE a SET d=current_date;
UPDATE 3
demo=# SELECT * FROM a WHERE d=current_date;
ERROR: operator does not exist: character varying = date at character 24
HINT: No operator matches the given name and argument type(s). You
might need t
o add explicit type casts.
LINE 1: SELECT * FROM a WHERE d=current_date;

so and now think what takes happen in plpgsql functions if you work with
variables.

DECLARE z INTEGER;

calculations

UPDATE a SET b=z WHERE xyz;

GET DIAGNOSTICS rows = ROW_COUNT;
IF rows=0 THEN
ELSE
FOR r IN SELECT * FROM a WHERE b=z....
END IF;

i know that are hypotethical issues but i will show the risk.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2008-05-06 11:16:30 Re: now i'm really confused. insert/update does autocast, where sometimes.
Previous Message Daniel Schuchardt 2008-05-06 09:31:55 now i'm really confused. insert/update does autocast, where sometimes.