From: Franklin Haut <franklin.haut@gmail.com>
To: pgsql-sql@postgresql.org
Subject: SQL state: 22P02
Date: Thu, 22 Nov 2007 13:24:36 -0300
Message-ID: <4745AD44.1@gmail.com> (raw)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
<small><font face="Courier New">Hi,<br>
<br>
I got the message "SQL state: 22P02" <br>
<br>
<br>
<br>
<b>to produce:</b><br>
<br>
create table test (num varchar(20));<br>
<br>
insert into test (num) values (null);<br>
select * from test where cast(num as int8) = 0; --ok, no error<br>
insert into test (num) values ('123123');<br>
select * from test where cast(num as int8) = 123123; --ok, no error<br>
<br>
insert into test (num) values (' ');<br>
select * from test where cast(num as int8) = 123123; -- error<br>
select * from test where case when trim(num) <> '' then cast(num
as int8) = 123123 else false end; -- ok, changed query and no error<br>
<br>
insert into test (num) values ('a');<br>
select * from test where cast(num as int8) = 123123; -- error<br>
select * from test where case when trim(num) <> '' then cast(num
as int8) = 123123 else false end; -- error<br>
<br>
I need get all tuples was the table have converting the characters to
number. If one conversion fail there not displayed. <br>
<br>
<b>Ex:</b><br>
num return<br>
---- ------<br>
0 0<br>
null false<br>
12 12<br>
a false<br>
12ab false<br>
</font></small><font face="Courier New"><small><br>
it´s possible get these results ?<br>
<br>
<br>
other question:<br>
<br>
Why this message ("</small></font><small><font face="Courier New">SQL
state: 22P02</font></small><font face="Courier New"><small>") is not
displayed with the SQL command on log in data/pg_log ?<br>
only appears <br>
<br>
2007-11-22 12:55:13 BRT ERROR: invalid input syntax for integer: "a"<br>
<br>
<br>
thanks,<br>
<br>
Franklin Haut<br>
<br>
<br>
<br>
<br>
<br>
</small></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: SQL state: 22P02
In-Reply-To: <4745AD44.1@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