On 11/29/11 04:42, Claudio Valderrama C. wrote: >> -----Original Message----- >> From: Adriano dos Santos Fernandes [mailto:adrian...@gmail.com] >> Sent: Lunes, 28 de Noviembre de 2011 16:08 >> No. It happens with large varchar column. So it turns back to my >> question: can we describe a column with a length we know will fit and >> will have no side effects other than just being described different? > I tried to do that in my first implementation, but then we have a problem: > substring with parameters. Should > substring(s from :n for :m) > use the max length from "s" and > substring(s from 5 for 10) > use 10 if length(s) > 10 ??? > > >> Sure, a different descriptor would have no side effect in the >> index, but >> a change would be valid for any usage of substring. > Yes and the problem is that for an expression index to be used, AFAIK the > search expression should be identical, hence if somebody wants to use an > index created as > CREATE INDEX IDX1 ON tbl_test COMPUTED BY (CAST(SUBSTRING(col1 from 1 for > 20) as varchar(20))) > the user should write > where CAST(SUBSTRING(col1 from 1 for 20) as varchar(20)) = 'something' > > Not very elegant.
But taking into an account other considerations is the only correct. May be we can think about builting function like index_expr. That's just raw idea, but may be something like INDEX_EXPR(ALIAS.indexName) is better than CAST(SUBSTRING(col1 from 1 for 20) as varchar(20)) supposing that some ALIAS in current context has index indexName and value of expression will be calculated for current record in that alias? As a minimum benefit people need not review client code to change somewhere CAST(SUBSTRING(col1 from 1 for 20) as varchar(20)) to become CAST(SUBSTRING(col1 from 1 for 22) as varchar(22)). ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel