Cast in PG 8.3

From: Franklin Haut <franklin(dot)haut(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Cast in PG 8.3
Date: 2008-02-05 19:22:48
Message-ID: 47A8B788.6010304@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
<br>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
<font face="Courier New, Courier, monospace">Hi all,<br>
<br>
I&acute;m testing the new version of PostgreSQL in windows plataform but i
have a problem.<br>
<br>
<br>
<b>In PG 8.2 </b><br>
<br>
Create Table temp (id int4);<br>
insert into temp values (1215);<br>
insert into temp values (1216);<br>
insert into temp values (1217);<br>
insert into temp values (1218);<br>
insert into temp values (1219);<br>
insert into temp values (1220);<br>
insert into temp values (1221);<br>
insert into temp values (1222);<br>
SELECT * FROM TEMP WHERE id ilike ('%122%');<br>
<br>
return ok, 3 rows (1220, 1221 and 1222)<br>
<br>
<br>
<br>
<b>In PG 8.3<br>
<br>
</b>Create Table temp (id integer);<br>
insert into temp values (1215);<br>
insert into temp values (1216);<br>
insert into temp values (1217);<br>
insert into temp values (1218);<br>
insert into temp values (1219);<br>
insert into temp values (1220);<br>
insert into temp values (1221);<br>
insert into temp values (1222);<br>
SELECT * FROM TEMP WHERE id ilike ('%122%');<br>
<br>
<b>Error:</b><br>
operator does not exist: integer ~~* unknown at character 31<br>
HINT:&nbsp; No operator matches the given name and argument type(s). <br>
You might need to add explicit type casts.<br>
<br>
<br>
I Know that changing the SQL command to :<br>
</font><font face="Courier New, Courier, monospace">SELECT * FROM TEMP
WHERE CAST(id AS TEXT) ilike ('%122%'); <br>
work&acute;s but for now isn't possible... :(<br>
<br>
</font><font face="Courier New, Courier, monospace"><br>
I Tries&nbsp; create a cast but the function text doesn't exist more in PG
8.3<br>
<br>
CREATE CAST (int AS text) WITH FUNCTION text(int);<br>
<br>
can everyone help me to create a cast ou other solution ?<br>
<br>
Thank&acute;s <br>
<br>
<br>
Franklin<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</font>
</body>
</html>

Attachment Content-Type Size
unknown_filename text/html 2.1 KB

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Li, Jingfa 2008-02-05 19:39:26 Re: Cast in PG 8.3
Previous Message Jaime Casanova 2008-02-05 19:18:54 Re: Cast in PG 8.3