Subject Re: [firebird-support] Re: substr(s,m,n) caused arithmetic exception, numeric overflow, or string truncation
Author Helen Borrie
Ben,
At 05:40 AM 21/12/2003 +0000, you wrote:
>Helen, I now discover this problem is truly a bug or a limitation
>of Firebird. To reproduce this problem, you need to insert a string
>longer than 80 characters into a varchar(255), and then try to
>do a substr on it.

Confirmed, it's a bug, and it's also present in Fb 1.0.3. It also affects
the substrlen() and lower() functions and quite likely all of the string
functions. It seems that someone has altered the parameter processing for
ext. funcs and it accidentally became a requirement to pass a cstring no
longer than the declared length. This function didn't always except this
way and it hasn't been reported as a deliberate change.

heLen


>Ben
>
>--- In firebird-support@yahoogroups.com, "vmdd_tech"
><vmdd_tech@y...> wrote:
> > Helen, I've just run the same test on my home computer (win xp),
>and
> > substr works fine. The problem may be specific to my work
> > computer. I will
> > investigate some more.
> >
> > Thanks,
> >
> > Binh
> >
> > --- In firebird-support@yahoogroups.com, Helen Borrie
><helebor@t...>
> > wrote:
> > > At 02:07 PM 19/12/2003 -0800, you wrote:
> > > >Background: FB 1.5 RC6, Windows 2000.
> > > >
> > > >I have table news where txt is a column defined as
> > > >varchar(255).
> > > >
> > > >When issuing the SQL:
> > > >select substr(txt,1,2) from news;
> > > >
> > > >
> > > >Then, I get the mentioned error. I am certain that
> > > >all txt rows contains enough text (20 characters or
> > > >more).
> > >
> > > Is the example the way you are actually calling the UDF? The
> > exception
> > > you report shouldn't (couldn't) occur with this statement.
> > >
> > > fwiw, I've just run your statement on several samples, including
>a
> > unicode
> > > column that has null on several rows, without exception.
> > >
> > > Firebird has an internal function SUBSTRING() which avoids the
> > UDF, btw.
> > >
> > > select substring(txt FROM 1 FOR 2) as outputcol from news;
> > >
> > > /heLen
>
>
>To unsubscribe from this group, send an email to:
>firebird-support-unsubscribe@yahoogroups.com
>
>
>
>Yahoo! Groups Links
>
>To visit your group on the web, go to:
> http://groups.yahoo.com/group/firebird-support/
>
>To unsubscribe from this group, send an email to:
> firebird-support-unsubscribe@yahoogroups.com
>
>Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/