Julius Tuskenis <julius@xxxxxxxx> writes: > select '1' = 1 results in true This is a undecorated literal, which PostgreSQL will cast as integer when it discovers that's what makes sense. > while select sum(msg_price) from messages where msg_itemid = 0 results in > error: > ERROR: operator does not exist: character varying = integer > LINE 1: select sum(msg_price) from messages where msg_itemid = 0 Here, msg_itemid is known to be a varchar, and 0 is a numeric literal, which is in the range of an integer, so the type is resolved as an integer. Now the = operator does not exist for varchar, integer. > I will add the operator ant then we'll fix the queries, but is the first > example ok? Should it not raise error ? Not as written. Try to decorate the literal to force PostgreSQL into considering it of the type you have in mind: SELECT text '1' = 1; Or even do a cast, this way: SELECT '1'::text = 1; Regards, -- dim -- Sent via pgsql-admin mailing list (pgsql-admin@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin