153 lines
4.1 KiB
Text
153 lines
4.1 KiB
Text
|
================================================================================
|
||
|
basic
|
||
|
================================================================================
|
||
|
with w as (select * from foo) select * from w;
|
||
|
--------------------------------------------------------------------------------
|
||
|
|
||
|
(source_file
|
||
|
(select_statement
|
||
|
(with_query
|
||
|
(with_query_item
|
||
|
(identifier)
|
||
|
(select_statement
|
||
|
(select_item
|
||
|
(star))
|
||
|
(select_from
|
||
|
(from_item
|
||
|
(from_table
|
||
|
(identifier)))))))
|
||
|
(select_item
|
||
|
(star))
|
||
|
(select_from
|
||
|
(from_item
|
||
|
(from_table
|
||
|
(identifier))))))
|
||
|
|
||
|
================================================================================
|
||
|
materialized
|
||
|
================================================================================
|
||
|
with w as materialized (select * from foo) select * from w;
|
||
|
--------------------------------------------------------------------------------
|
||
|
|
||
|
(source_file
|
||
|
(select_statement
|
||
|
(with_query
|
||
|
(with_query_item
|
||
|
(identifier)
|
||
|
(select_statement
|
||
|
(select_item
|
||
|
(star))
|
||
|
(select_from
|
||
|
(from_item
|
||
|
(from_table
|
||
|
(identifier)))))))
|
||
|
(select_item
|
||
|
(star))
|
||
|
(select_from
|
||
|
(from_item
|
||
|
(from_table
|
||
|
(identifier))))))
|
||
|
|
||
|
================================================================================
|
||
|
not materialized
|
||
|
================================================================================
|
||
|
with w as not materialized (select * from foo) select * from w;
|
||
|
--------------------------------------------------------------------------------
|
||
|
|
||
|
(source_file
|
||
|
(select_statement
|
||
|
(with_query
|
||
|
(with_query_item
|
||
|
(identifier)
|
||
|
(select_statement
|
||
|
(select_item
|
||
|
(star))
|
||
|
(select_from
|
||
|
(from_item
|
||
|
(from_table
|
||
|
(identifier)))))))
|
||
|
(select_item
|
||
|
(star))
|
||
|
(select_from
|
||
|
(from_item
|
||
|
(from_table
|
||
|
(identifier))))))
|
||
|
|
||
|
================================================================================
|
||
|
with delete
|
||
|
================================================================================
|
||
|
with new as (delete from productes returning *) select 1;
|
||
|
--------------------------------------------------------------------------------
|
||
|
|
||
|
(source_file
|
||
|
(select_statement
|
||
|
(with_query
|
||
|
(with_query_item
|
||
|
(identifier)
|
||
|
(delete_statement
|
||
|
(identifier)
|
||
|
(select_item
|
||
|
(star)))))
|
||
|
(select_item
|
||
|
(number))))
|
||
|
|
||
|
================================================================================
|
||
|
with insert
|
||
|
================================================================================
|
||
|
with new as (insert into foo values(1)) select 1;
|
||
|
--------------------------------------------------------------------------------
|
||
|
|
||
|
(source_file
|
||
|
(select_statement
|
||
|
(with_query
|
||
|
(with_query_item
|
||
|
(identifier)
|
||
|
(insert_statement
|
||
|
(identifier)
|
||
|
(insert_items
|
||
|
(insert_item
|
||
|
(number))))))
|
||
|
(select_item
|
||
|
(number))))
|
||
|
|
||
|
================================================================================
|
||
|
many
|
||
|
================================================================================
|
||
|
with w as (
|
||
|
select * from foo
|
||
|
), x as (
|
||
|
select * from bar
|
||
|
) select * from foo, bar;
|
||
|
--------------------------------------------------------------------------------
|
||
|
|
||
|
(source_file
|
||
|
(select_statement
|
||
|
(with_query
|
||
|
(with_query_item
|
||
|
(identifier)
|
||
|
(select_statement
|
||
|
(select_item
|
||
|
(star))
|
||
|
(select_from
|
||
|
(from_item
|
||
|
(from_table
|
||
|
(identifier))))))
|
||
|
(with_query_item
|
||
|
(identifier)
|
||
|
(select_statement
|
||
|
(select_item
|
||
|
(star))
|
||
|
(select_from
|
||
|
(from_item
|
||
|
(from_table
|
||
|
(identifier)))))))
|
||
|
(select_item
|
||
|
(star))
|
||
|
(select_from
|
||
|
(from_item
|
||
|
(from_table
|
||
|
(identifier)))
|
||
|
(from_item
|
||
|
(from_table
|
||
|
(identifier))))))
|