Skip to content

Commit

Permalink
Merge pull request #2029 from taozhi8833998/fix-type
Browse files Browse the repository at this point in the history
fix: type definition
  • Loading branch information
taozhi8833998 authored Jul 29, 2024
2 parents 3f9c7b3 + 47162ff commit d4f8ea1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ast/postgresql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,15 @@ export type create_function_stmt_t = {

export type create_function_stmt = AstStatement<create_function_stmt_t>;

export type create_type_stmt_option = { as: 'as'; resource: string; create_definitions: expr_list | create_column_definition_list; } | ignore;

export type create_type_stmt_t = {
type: 'create',
keyword: 'type',
name: { schema: string; name: string },
as?: string,
resource?: string,
create_definitions?: any
create_definitions?: expr_list | create_column_definition_list;
}

export type create_type_stmt = AstStatement<create_type_stmt_t>;
Expand Down Expand Up @@ -294,6 +296,8 @@ export type column_definition_opt_list = {
reference_definition?: reference_definition;
};

export type create_column_definition_list = create_column_definition[];



export type create_column_definition = {
Expand Down
2 changes: 2 additions & 0 deletions pegjs/postgresql.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,7 @@ create_function_stmt

create_type_stmt_option
= KW_AS __ r:(KW_ENUM / 'RANGE'i) __ LPAREN __ e:expr_list? __ RPAREN {
// => { as: 'as'; resource: string; create_definitions: expr_list | create_column_definition_list; }
e.parentheses = true
return {
as: 'as',
Expand All @@ -742,6 +743,7 @@ create_type_stmt_option
}
}
/ KW_AS __ LPAREN __ e:create_column_definition_list? __ RPAREN {
// => ignore
return {
as: 'as',
create_definitions: e,
Expand Down

0 comments on commit d4f8ea1

Please sign in to comment.