[Cubicweb] Error in SUBSTRING documentation ?

Julien Cristau julien.cristau at logilab.fr
Wed Nov 19 18:13:38 CET 2014


On Wed, Nov 19, 2014 at 17:53:12 +0100, Yann Cointepas wrote:

> Hi,
> 
> I suspect that SUBSTRING(String, start, length)is implemented as
> String[start:length] in Python (because I have to use start=0 and length=8
> to compare the first 7 characters). If I am right, the name of the
> parameters and the documentation on the RQL web page are wrong, length is
> not a length but the index after the last character.
> 
As far as I can tell this is because 'start' counts from 1, so for the
first 7 characters you'd use SUBSTRING(String, 1, 7).

On postgresql, the SUBSTRING rql function maps to the substr sql
function, see
http://www.postgresql.org/docs/9.4/static/functions-string.html

Cheers,
Julien
-- 
Julien Cristau          <julien.cristau at logilab.fr>
Logilab		        http://www.logilab.fr/
Informatique scientifique & gestion de connaissances



More information about the Cubicweb mailing list