The deeply nested string replace pattern comes up frequently.  A
suggestion.  Why not a built in aggregate replace function?

As such, the example here would be more readable and not limited by stack
depth as the expression:

SELECT replace(Transcript,column1,column2) FROM (VALUES
(',',''),(';',''),...)




On Thu, Aug 3, 2017 at 3:38 AM, Richard Hipp <d...@sqlite.org> wrote:

> I am unable to reproduce the problem.  Do you have any additional
> hints on how to make this fail?
>
> The depth of the stack in the push-down automaton used by the parser
> is deliberately limited to 100 levels.  This is a feature, not a bug.
> See https://www.sqlite.org/compile.html#yystackdepth for additional
> information.
>
> On 8/3/17, Brian Clifford <brian.cliff...@thinksmartbox.com> wrote:
> > Hi,
> >
> > I've subscribed to the sqllite mailing list but am still awaiting
> > authorization.
> >
> > I'd like to report a bug I found with sqlite where I'm creating a
> function
> > index which consists of approx 36 nested calls to the replace() function
> > (to remove punctuation)
> >
> > I get a parser stackoverflow exception after about 28 nested calls.
> >
> > Below is the pseudo-code I use for creating my table and the function
> index
> > -------
> >
> > string _ReplacePunctuationFunctionPart =
> > "replace(replace(replace(replace(replace(replace(
> replace(replace(replace(replace(replace(replace(replace(replace(replace(
> replace(replace(replace(replace(replace(replace(replace(replace(replace(
> replace(replace(replace(Transcript,',',''),';',''),':'
> ,''),'[',''),']',''),'{',''),'}',''),'(',''),')',''),'\','')
> ,'/',''),'"',''),'_',''),'+',''),'=',''),'£',''),'$',''),'€'
> ,''),'%',''),'^',''),'&',''),'*',''),'@',''),'#',''),'”',''),'“',''),'
> > ','')"
> >
> >
> >  "CREATE TABLE \"Recordings\" (\"Id\" INTEGER PRIMARY KEY AUTOINCREMENT
> NOT
> > NULL, \"Transcript\" TEXT NOT NULL COLLATE NOCASE, \"Mp3FileName\" TEXT
> NOT
> > NULL UNIQUE, \"Label\" TEXT);";
> >  "CREATE UNIQUE INDEX RecordingsMp3Index ON Recordings(Mp3FileName);";
> >  "CREATE INDEX RecordingsTextIndex ON Recordings(Transcript);";
> >  string.Format("CREATE INDEX RecordingsNoPunctuationIdx ON
> > Recordings({0});", _ReplacePunctuationFunctionPart);
> >
> >  .... SELECT ....
> >
> >  string.Format("SELECT Id, {0} as 'TranscriptNoPunctuation' FROM
> > Recordings;", _ReplacePunctuationFunctionPart);
> >
> > ------
> >
> > regards,
> >
> > *Brian Clifford*
> > Software Developer
> >
> > --
> >
> >
> > <http://www.thinksmartbox.com>
> >
> > www.thinksmartbox.com
> >
> > Facebook <https://www.facebook.com/thinksmartbox>  Twitter
> > <https://twitter.com/ThinkSmartbox>  LinkedIn
> > <https://www.linkedin.com/company/smartbox-assistive-technology>
> YouTube
> > <https://www.youtube.com/user/SmartboxAT>
> >
> > Smartbox Assistive Technology, Ysobel House, Enigma Commercial Centre,
> > Sandys
> > Road, Malvern, WR14 1JJ
> >
> > Tel: +44 (0) 1684 578868
> > _______________________________________________
> > sqlite-users mailing list
> > sqlite-users@mailinglists.sqlite.org
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >
>
>
> --
> D. Richard Hipp
> d...@sqlite.org
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to