I am having problems querying varstrlst field using LIKE
We are running Commercial Version 4.00.1009527445 of Dec 28, 2001 (sparc-sun-solaris2.6-64)
It looks like only first 45 bytes of varstrlst field are being looked at.
CREATE TABLE test_table (
id int NOT NULL,
priprod varstrlst,
secprod varstrlst,
info varchar(200)
);
insert into test_table values (1,'P10,P11,P12,P13,P14,P15,P16,P17,','','');
insert into test_table values (2,'P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,','','');
insert into test_table values (3,'P100,P110,P120,P130,P140,P15,P16,P17,P18,P19,P20,P21,P22,','','');
insert into test_table values (4,'P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P23,P24,P25,P26,P27,P16,P17,P18,P19,P20,P21,P22,','','');
SQL 1>select id,priprod from test_table where priprod like 'P21';
id priprod
------------+------------+
2 P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,
Note only one record was returned instead of three
Query
select id,priprod from test_table where priprod like 'P22';
returns no records even though three should be returned
Query
select id,priprod from test_table where priprod like 'P1'
returns all the rows even though only one should be returned.
If I'll build a metamorph index on this field
CREATE METAMORPH INDEX test_table_priprod_idx
ON test_table(priprod);
Everything works as it should, but any new records which were inserted after the index was created are not searchable and I get the following error
SQL 1>select * from test_table where priprod like 'P22';
100 Can't rank FTN type 20 in the function i3dbinsertp
100 Can't rank FTN type 20 in the function i3dbinsertp
100 Can't rank FTN type 20 in the function i3dbinsertp
100 Can't rank FTN type 20 in the function i3dbinsertp
100 Can't rank FTN type 20 in the function i3dbinsertp
id priprod secprod info
------------+------------+------------+------------+
2 P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,
4 P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P23,P24,P25,P26,P27,P16,P17,P18,P19,P20,P21,P22,
5 P99,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P23,P24,P25,P26,P27,P16,P17,P18,P19,P20,P21,P22,
3 P100,P110,P120,P130,P140,P15,P16,P17,P18,P19,P20,P21,P22,
I know that for my examples query can be modified to use
"=" instead of like, but this is not the queries I am running in the production environment.
I have to be able to list multiple items
select id,priprod from test_table where priprod like 'P22,P17,P21 @0';
and also 'In' syntax doesn't seem to work for varstrlst fields
select id,priprod from test_table where priprod in ('P22','P17','P21');
Please Help
Thanks
-Sergey
We are running Commercial Version 4.00.1009527445 of Dec 28, 2001 (sparc-sun-solaris2.6-64)
It looks like only first 45 bytes of varstrlst field are being looked at.
CREATE TABLE test_table (
id int NOT NULL,
priprod varstrlst,
secprod varstrlst,
info varchar(200)
);
insert into test_table values (1,'P10,P11,P12,P13,P14,P15,P16,P17,','','');
insert into test_table values (2,'P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,','','');
insert into test_table values (3,'P100,P110,P120,P130,P140,P15,P16,P17,P18,P19,P20,P21,P22,','','');
insert into test_table values (4,'P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P23,P24,P25,P26,P27,P16,P17,P18,P19,P20,P21,P22,','','');
SQL 1>select id,priprod from test_table where priprod like 'P21';
id priprod
------------+------------+
2 P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,
Note only one record was returned instead of three
Query
select id,priprod from test_table where priprod like 'P22';
returns no records even though three should be returned
Query
select id,priprod from test_table where priprod like 'P1'
returns all the rows even though only one should be returned.
If I'll build a metamorph index on this field
CREATE METAMORPH INDEX test_table_priprod_idx
ON test_table(priprod);
Everything works as it should, but any new records which were inserted after the index was created are not searchable and I get the following error
SQL 1>select * from test_table where priprod like 'P22';
100 Can't rank FTN type 20 in the function i3dbinsertp
100 Can't rank FTN type 20 in the function i3dbinsertp
100 Can't rank FTN type 20 in the function i3dbinsertp
100 Can't rank FTN type 20 in the function i3dbinsertp
100 Can't rank FTN type 20 in the function i3dbinsertp
id priprod secprod info
------------+------------+------------+------------+
2 P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,
4 P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P23,P24,P25,P26,P27,P16,P17,P18,P19,P20,P21,P22,
5 P99,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P23,P24,P25,P26,P27,P16,P17,P18,P19,P20,P21,P22,
3 P100,P110,P120,P130,P140,P15,P16,P17,P18,P19,P20,P21,P22,
I know that for my examples query can be modified to use
"=" instead of like, but this is not the queries I am running in the production environment.
I have to be able to list multiple items
select id,priprod from test_table where priprod like 'P22,P17,P21 @0';
and also 'In' syntax doesn't seem to work for varstrlst fields
select id,priprod from test_table where priprod in ('P22','P17','P21');
Please Help
Thanks
-Sergey