with recursive t(i, s) as ( select 0, 'foo' union all select i+1, s || 'bar' from t where i < 1) select last(s order by i) as s from t;