Hi!
Take a look at this:
Code:
drop table t;
create table t (
c varchar(255) not null
) with structure = vectorwise;
insert into t values('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxa');
select
position('a', c) as p,
position('a', c) + 1 as pa,
locate(c, 'a') as l,
locate(c, 'a') + 1 as la
from t
\g
This is the output:
Code:
┌─────────────┬──────────────────────┬─────────────┬──────────────────────┐
│p │pa │l │la │
├─────────────┼──────────────────────┼─────────────┼──────────────────────┤
│ 127│ -128│ 127│ 128│
└─────────────┴──────────────────────┴─────────────┴──────────────────────┘
So the POSITION function returns a signed byte, which overflows within the +1 expression. There is no such problem with standard ingres table or when LOCATE function is used instead of POSITION.
Best regards!