X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id ACC695280D for ; Fri, 17 Jun 2005 07:02:57 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 74152-01 for ; Fri, 17 Jun 2005 10:02:47 +0000 (GMT) Received: from ns1.intersan.com.tr.intersan.com.tr (unknown [81.215.12.210]) by svr1.postgresql.org (Postfix) with ESMTP id 5FF2152828 for ; Fri, 17 Jun 2005 07:02:38 -0300 (ADT) Received: from cerit (unknown [10.0.0.99]) by ns1.intersan.com.tr.intersan.com.tr (Postfix) with ESMTP id 5A32C3FF14 for ; Fri, 17 Jun 2005 13:01:48 +0300 (EEST) Message-ID: <014a01c57323$90b72b20$b8e58bd5@cerit> From: "Fatih Cerit" To: Subject: substr or char_length problem Date: Fri, 17 Jun 2005 13:01:15 +0300 Organization: intersan ltd. MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-9"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.842 tagged_above=0 required=5 tests=FORGED_RCVD_HELO, RCVD_IN_NJABL_DUL, RCVD_IN_SORBS_DUL X-Spam-Level: * X-Archive-Number: 200506/216 X-Sequence-Number: 21817 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