tree-sitter-plpgsql/corpus/insert_statement/insert.txt

161 lines
4.5 KiB
Text
Raw Normal View History

2021-08-28 13:46:32 +03:00
================================================================================
basic
================================================================================
insert into my_table values(1);
--------------------------------------------------------------------------------
(source_file
(insert_statement
(identifier)
(insert_items
(insert_item
(number)))))
================================================================================
alias
================================================================================
insert into foo.my_table as alias values(1);
--------------------------------------------------------------------------------
(source_file
(insert_statement
(identifier)
(as
(identifier))
(insert_items
(insert_item
(number)))))
================================================================================
default values
================================================================================
insert into foo.my_table default values;
--------------------------------------------------------------------------------
(source_file
(insert_statement
(identifier)
(insert_items)))
================================================================================
many values
================================================================================
insert into foo.my_table values(1, 2);
--------------------------------------------------------------------------------
(source_file
(insert_statement
(identifier)
(insert_items
(insert_item
(number))
(insert_item
(number)))))
================================================================================
different kind of values
================================================================================
insert into foo.my_table values(1, DEFAULT, (select 1, 2));
--------------------------------------------------------------------------------
(source_file
(insert_statement
(identifier)
(insert_items
(insert_item
(number))
(insert_item)
(insert_item
(select_statement
(select_item
(number))
(select_item
(number)))))))
================================================================================
insert from select
================================================================================
insert into foo.my_table select column1 from foo bar;
--------------------------------------------------------------------------------
(source_file
(insert_statement
(identifier)
(insert_items
(select_statement
(select_item
(identifier))
(select_from
(from_item
(from_table
(identifier)
(identifier))))))))
================================================================================
returning
================================================================================
insert into foo values(1) returning *, 1;
--------------------------------------------------------------------------------
(source_file
(insert_statement
(identifier)
(insert_items
(insert_item
(number)))
2021-09-01 20:15:10 +03:00
(returning
2021-08-28 13:46:32 +03:00
(select_item
(star))
(select_item
(number)))))
================================================================================
with cte
================================================================================
with foo as (select * from bar)
insert into my_table values(1);
--------------------------------------------------------------------------------
(source_file
(insert_statement
(with_query
(with_query_item
(identifier)
(select_statement
(select_item
(star))
(select_from
(from_item
(from_table
(identifier)))))))
(identifier)
(insert_items
(insert_item
(number)))))
================================================================================
returning into
================================================================================
insert into foo(bar, baz) select * from another
returning id into _var;
--------------------------------------------------------------------------------
(source_file
(insert_statement
(identifier)
(identifier)
(identifier)
(insert_items
(select_statement
(select_item
(star))
(select_from
(from_item
(from_table
(identifier))))))
2021-09-01 20:15:10 +03:00
(returning
2021-08-28 13:46:32 +03:00
(select_item
(identifier)))
(into
(identifier))))