substr or char_length problem

From: "Fatih Cerit" <fatih(at)intersan(dot)com(dot)tr>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: substr or char_length problem
Date: 2005-06-17 10:01:15
Message-ID: 014a01c57323$90b72b20$b8e58bd5@cerit
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Dear ALL

I have a problem with function substr or char_length or both. I guery A2 and
it works fine. But sometimes gives 'ERROR: negative substring length not
allowed'. When I test many many times with diffrent values, never gives
error. Sample table and query below.

A1 A2
-------------------
1 1957
2 197
3 19
4
5 NULL
6 1
7 195

Select * from tbl_xxx where
tbl_xxx.A2=substr('196895588454554545454',0,char_length(tbl_xxx.A2)+1);

Thanks
Fatih Cerit

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Andreas Kretschmer 2005-06-17 10:25:28 Re: [despammed] substr or char_length problem
Previous Message Jaime Casanova 2005-06-17 05:42:22 Re: Putting an INDEX on a boolean field?