I've been playing around a bit with the `nextchar` extension and I must say
it's pretty neat! Basically I create a table named `words` with a single
TEXT column named `word` and populate it with a dictionary file. Then I can
run:

SELECT nextchar('partial word', 'words', 'word');

And it will return a string containing all the characters that could
possibly be the "next char" of a valid word.

For example:

nextchar('foota') -> 'g'
nextchar('footag') -> 'e'
nextchar('footage') -> no result

As a challenge I was curious how one would write a recursive CTE to take a
substring and recursively calculate all possible matches. I realize I could
just use 'LIKE xxx%' to accomplish the same, but if anyone has any thoughts
on writing such a query I'd love to hear them!

Reply via email to