I have the transitive reduction of a binary relation stored in a table and 
I would like to create a temporary table which contains the transitive 
closure of the binary relation. I have created a recursive statement that 
computes the transitive closure but I don't know how to combined this with 
a create table statement. The SQL below correctly creates the table with 
the correct row but the first statement generates a syntax error.

WITH RECURSIVE t(sub,sup) AS ( SELECT sub,sup from public.relation where 
TYPE='proper' or TYPE ='inclusion' UNION ALL SELECT g.sub,rel.sup FROM t as 
rel INNER JOIN public.relation g ON rel.sub = g.sup );
 
CREATE TEMP TABLE PUBLIC.RELATION_TRANSITIVE AS (SELECT * FROM T);

I want to create the table because the recursive statement is time 
expensive. I will use the temporary table in other queries. The temporary 
table will be regenerated each time the underlying relation is changed, 
which is infrequently.

Is it possible to construct a temporary table from a recursive statement 
without SQL syntax errors?

Thanks in advance

-- 
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to