From: Franklin Haut <franklin.haut@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Cast in PG 8.3
Date: Tue, 05 Feb 2008 16:22:48 -0300
Message-ID: <47A8B788.6010304@gmail.com> (raw)
<!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´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: 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´s but for now isn't possible... :(<br>
<br>
</font><font face="Courier New, Courier, monospace"><br>
I Tries 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´s <br>
<br>
<br>
Franklin<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</font>
</body>
</html>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: franklin.haut@gmail.com
Subject: Re: Cast in PG 8.3
In-Reply-To: <47A8B788.6010304@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox