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

Поиск
Список
Период
Сортировка
От Daniel Schuchardt
Тема Re: now i'm really confused. insert/update does autocast, where sometimes.
Дата
Msg-id fvpa00$31fb$1@news.hub.org
обсуждение исходный текст
Ответ на operator varchar = integer  (Daniel Schuchardt <daniel_schuchardt@web.de>)
Список 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.

В списке pgsql-general по дате отправления:

Предыдущее
От: Daniel Schuchardt
Дата:
Сообщение: Re: operator is not unique: integer || integer
Следующее
От: Daniel Schuchardt
Дата:
Сообщение: now i'm really confused. insert/update does autocast, where sometimes.