tree-sitter-plpgsql/test/corpus/create/table.txt

170 lines
4.1 KiB
Text
Raw Normal View History

2023-01-06 23:52:08 +03:00
================================================================================
Create an empty table
================================================================================
create table foo ();
--------------------------------------------------------------------------------
(source_file
(statement
(create_table
(keyword_create)
(keyword_table)
(table_reference
name: (identifier)
)
(column_definitions)
)
)
)
================================================================================
Create an empty table in specified schema
================================================================================
create table public.foo ();
--------------------------------------------------------------------------------
(source_file
(statement
(create_table
(keyword_create)
(keyword_table)
(table_reference
schema: (identifier)
name: (identifier)
)
(column_definitions)
)
)
)
================================================================================
Create an empty temporary table
================================================================================
create temporary table foo ();
create temp table foo ();
--------------------------------------------------------------------------------
(source_file
(statement
(create_table
(keyword_create)
(keyword_temporary)
(keyword_table)
(table_reference
name: (identifier)
)
(column_definitions)
)
)
(statement
(create_table
(keyword_create)
(keyword_temporary)
(keyword_table)
(table_reference
name: (identifier)
)
(column_definitions)
)
)
)
================================================================================
Create an empty unlogged table
================================================================================
create unlogged table foo ();
--------------------------------------------------------------------------------
(source_file
(statement
(create_table
(keyword_create)
(keyword_unlogged)
(keyword_table)
(table_reference
name: (identifier)
)
(column_definitions)
)
)
)
================================================================================
Create an empty table if not exists
================================================================================
create table if not exists foo ();
--------------------------------------------------------------------------------
(source_file
(statement
(create_table
(keyword_create)
(keyword_table)
(keyword_if)
(keyword_not)
(keyword_exists)
(table_reference
name: (identifier)
)
(column_definitions)
)
)
)
2023-01-07 01:30:38 +03:00
================================================================================
Create a table with different columns
================================================================================
create table foo (
c1 text,
c2 boolean,
c3 numeric(1),
c4 timestamp with time zone,
c5 varchar(120),
c6 uuid
);
--------------------------------------------------------------------------------
(source_file
(statement
(create_table
(keyword_create)
(keyword_table)
(table_reference
name: (identifier)
)
(column_definitions
(column_definition
name: (identifier)
datatype: (keyword_text)
)
(column_definition
name: (identifier)
datatype: (keyword_boolean)
)
(column_definition
name: (identifier)
datatype: (numeric
(keyword_numeric)
precision: (literal)
)
)
(column_definition
name: (identifier)
datatype: (keyword_timestamptz)
)
(column_definition
name: (identifier)
datatype: (varchar
(keyword_varchar)
size: (literal)
)
)
(column_definition
name: (identifier)
datatype: (keyword_uuid)
)
)
)
)
)