Re: With Recursive / Recursive View question

2022-08-21 Thread Peter J. Holzer
On 2022-08-20 17:42:27 -0500, Perry Smith wrote: > This select is almost instant: > > > WITH RECURSIVE pathname(id, parent_id, basename) AS ( > SELECT child.id, child.parent_id, child.basename > FROM dirents child > WHERE basename = '10732.emlx' > UNION ALL >

Re: ***SPAM*** Re: With Recursive / Recursive View question

2022-08-20 Thread Perry Smith
> On Aug 20, 2022, at 19:38, Christophe Pettus wrote: > > >> On Aug 20, 2022, at 15:42, Perry Smith wrote: >> >> To rephrase, is it possible to write a view that would work from the child >> terms out towards the ancestors? > > Assuming that the concern is that you want to parameterize this

Re: ***SPAM*** Re: With Recursive / Recursive View question

2022-08-20 Thread Perry Smith
> On Aug 20, 2022, at 19:38, Christophe Pettus wrote: > > > >> On Aug 20, 2022, at 15:42, Perry Smith wrote: >> >> To rephrase, is it possible to write a view that would work from the child >> terms out towards the ancestors? > > Assuming that the concern is that you want to parameterize

Re: With Recursive / Recursive View question

2022-08-20 Thread Christophe Pettus
> On Aug 20, 2022, at 15:42, Perry Smith wrote: > > To rephrase, is it possible to write a view that would work from the child > terms out towards the ancestors? Assuming that the concern is that you want to parameterize this predicate: WHERE basename = '10732.emlx' ... you mig

With Recursive / Recursive View question

2022-08-20 Thread Perry Smith
This select is almost instant: WITH RECURSIVE pathname(id, parent_id, basename) AS ( SELECT child.id, child.parent_id, child.basename FROM dirents child WHERE basename = '10732.emlx' UNION ALL SELECT parent.id, parent.parent_id, CONCAT(parent.basename, '/', child.basename) F