On 26/02/2018 12:19, Cezary H. Noweta wrote:
Hello,

On 2018-02-26 11:38, Hick Gunter wrote:
The substr(x,y,z) function is defined only for nonzero values of y. SQlite can return whatever it feels like if you insist on providing invalid input. With "being nice to the user" and "making a best effort to return sensible data even for nonsense input" as design goals, mapping substr(x,0,z) to substr(x,1,z-1) seems quite a benign solution.

... and as such, that design could be documented.

I have been using SQLite for several years but I didn't know this feature. I quite agree with your answers.

Thanks to both of you.

Just a personal comment: if we consider that the query, with Y=0, has no legitimate answer (an empty string IS a legitimate answer), returning "null" could also be a "user-friendly" answer, perhaps better at alerting the user of the use of an invalid parameter.

J-L Hainaut

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to