Encountering an error when creating a view of a CTE. Create view select 1 
works, the CTE itself works, merging yields a Table T not found error.

Did this ever make it in to 1.4.200? If not are there any WIP branches I 
should look at?

-Jason

On Saturday, November 18, 2017 at 2:20:48 PM UTC-5 Noel Grandin wrote:

> On 18 November 2017 at 17:12, Stuart McMillan <[email protected]> wrote:
>
>> Noel, 
>>
>> Yes - certainly the session locking  (system or connection session) is 
>> one issue I have been wrestling with - especially when the CTE persistent 
>> views have to join the parent views lifecycle - I did a hacky-fix which I 
>> am not happy about to bypass that (and might not pass a code review).
>>
>
> there a couple of tricks we use in other places that might help.
>
> (1) we tie the lifetime of stuff to the lifetime of the top-level 
> statement, not to the lifetime of the parent object. When dealing with 
> circular stuff, this helps
>
> (2) when deleting these things, we use a loop that looks like
>   while (true)
>       progress = false
>       for each live object
>           progress |=  try to delete object
>       if (!progress) break
>  
>
>>
>> If we sidestep (ignore for the time being) my hacky attempts to bypass 
>> that issue - the next stumbling block was making the persistent views truly 
>> persistent - even across database reconnections. The blocker there is in 
>> reviving the cte views from their db persisted state - which fails dismally 
>> while using the plan SQL to re-create the cte views. I have to admit I was 
>> at a loss at how to fix that, since I do not understand the mechanism in 
>> which permanent DB-objects are persisted in H2. Which classes and fields 
>> are persisted in the db across connections/db-restarts for views and tables?
>>
>>
> It's actually (mostly) simple. We just store the SQL required to re-create 
> each object, and then we re-parse and re-execute each chunk of SQL at 
> startup. There is a couple of stages to make this work, and some flags to 
> say things like "this is db init, do not try doing validation/compile/etc 
> yet"
> And this all runs sequentially on the system session.
>
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/ba257192-0ce3-4a90-a3fb-97b131e0b1b7n%40googlegroups.com.

Reply via email to