Received: from sand6.global.net.uk (sand6.global.net.uk [195.147.246.105]) by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2QK29w55945 for ; Mon, 26 Mar 2001 15:02:09 -0500 (EST) (envelope-from Stephen.Jackson@panting-deer.org.uk) Received: from p1as02a03.client.global.net.uk ([195.147.162.27] helo=panting-deer.org.uk) by sand6.global.net.uk with esmtp (Exim 3.03 #1) id 14hdCg-0004Um-00 for pgsql-sql@postgresql.org; Mon, 26 Mar 2001 21:03:02 +0100 Message-ID: <3ABFA0AB.51025C8E@panting-deer.org.uk> Date: Mon, 26 Mar 2001 21:03:55 +0100 From: Stephen Jackson X-Mailer: Mozilla 4.7 [en] (Win95; I) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Implicit/Explicit casting of the unknown type Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200103/534 X-Sequence-Number: 2204 Hi, I am new to this list. I have browsed the list archives and tried a search, but haven't found anything about my problem. I am porting several applications to PostgreSQL and have come across a number of instances where a string literal does not work without an explicit cast to some character based datatype. Two examples are given below: one where the string literal is in the column list, and one where it is in a WHERE clause. Are there bugs in the area of determining a type for the unknown type? Or is explicit casting of string literals to a known type generally required by PostgreSQL? TIA, Stephen Jackson Home: Stephen.Jackson@panting-deer.org.uk www.panting-deer.org.uk Work: Stephen.Jackson@looksystems.co.uk www.looksystems.co.uk [begin examples] version --------------------------------------------------------------------- PostgreSQL 7.0.3 on i686-pc-linux-gnu, compiled by gcc egcs-2.91.66 (1 row) DROP TABLE strange DROP CREATE TABLE strange ( record_id integer ) CREATE INSERT INTO strange ( record_id ) VALUES ( 10 ) INSERT 5174249 1 SELECT DISTINCT record_id, 123 FROM strange WHERE record_id < 100 record_id | ?column? -----------+---------- 10 | 123 (1 row) SELECT DISTINCT record_id, 'Hello' FROM strange WHERE record_id < 100 ERROR: Unable to identify an ordering operator '<' for type 'unknown' Use an explicit ordering operator or modify the query SELECT record_id, 'Hello' FROM strange WHERE record_id < 100 record_id | ?column? -----------+---------- 10 | Hello (1 row) SELECT COUNT(*) FROM strange WHERE 'TR' || 'UE' = 'TRUE' count ------- 1 (1 row) SELECT COUNT(*) FROM strange WHERE 'TRUE' = 'TRUE' ERROR: Unable to identify an operator '=' for types 'unknown' and 'unknown' You will have to retype this query using an explicit cast [end examples]