{ "name": "plpgsql", "rules": { "source_file": { "type": "REPEAT", "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "psql_statement" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_statement" }, { "type": "STRING", "value": ";" } ] } ] } }, "_statement": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "psql_statement" }, { "type": "SYMBOL", "name": "create_function_statement" }, { "type": "SYMBOL", "name": "drop_function_statement" }, { "type": "SYMBOL", "name": "drop_type_statement" }, { "type": "SYMBOL", "name": "create_table_statement" }, { "type": "SYMBOL", "name": "create_schema_statement" }, { "type": "SYMBOL", "name": "create_type_statement" }, { "type": "SYMBOL", "name": "select_statement" }, { "type": "SYMBOL", "name": "insert_statement" }, { "type": "SYMBOL", "name": "delete_statement" }, { "type": "SYMBOL", "name": "update_statement" }, { "type": "SYMBOL", "name": "grant_statement" }, { "type": "SYMBOL", "name": "create_trigger_statement" }, { "type": "SYMBOL", "name": "create_sequence_statement" }, { "type": "SYMBOL", "name": "create_index_statement" }, { "type": "SYMBOL", "name": "alter_table_statement" }, { "type": "SYMBOL", "name": "do_block" } ] }, "drop_type_statement": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][rR][oO][pP]" }, "named": false, "value": "drop" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[tT][yY][pP][eE]" }, "named": false, "value": "type" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "if_exists" }, { "type": "BLANK" } ] }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "identifier" } ] } } ] }, { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][aA][sS][cC][aA][dD][eE]" }, "named": false, "value": "cascade" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[rR][eE][sS][tT][rR][iI][cC][tT]" }, "named": false, "value": "restrict" } ] }, { "type": "BLANK" } ] } ] }, "update_statement": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "with_query" }, { "type": "BLANK" } ] }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[uU][pP][dD][aA][tT][eE]" }, "named": false, "value": "update" }, { "type": "SYMBOL", "name": "identifier" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[aA][sS]" }, "named": false, "value": "as" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "identifier" } ] }, { "type": "BLANK" } ] }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[sS][eE][tT]" }, "named": false, "value": "set" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "update_set" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "update_set" } ] } } ] }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[fF][rR][oO][mM]" }, "named": false, "value": "from" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "from_item" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "from_item" } ] } } ] } ] }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "where_filter" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "returning" }, { "type": "BLANK" } ] } ] }, "drop_function_statement": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][rR][oO][pP]" }, "named": false, "value": "drop" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[fF][uU][nN][cC][tT][iI][oO][nN]" }, "named": false, "value": "function" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "drop_function_item" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "drop_function_item" } ] } } ] }, { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][aA][sS][cC][aA][dD][eE]" }, "named": false, "value": "cascade" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[rR][eE][sS][tT][rR][iI][cC][tT]" }, "named": false, "value": "restrict" } ] }, { "type": "BLANK" } ] } ] }, "drop_function_item": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "if_exists" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "identifier" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "(" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "var_declaration" }, { "type": "SYMBOL", "name": "_type" } ] }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "var_declaration" }, { "type": "SYMBOL", "name": "_type" } ] } ] } } ] }, { "type": "BLANK" } ] }, { "type": "STRING", "value": ")" } ] }, { "type": "BLANK" } ] } ] }, "create_type_statement": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][rR][eE][aA][tT][eE]" }, "named": false, "value": "create" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[tT][yY][pP][eE]" }, "named": false, "value": "type" }, { "type": "SYMBOL", "name": "identifier" }, { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[aA][sS]" }, "named": false, "value": "as" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[eE][nN][uU][mM]" }, "named": false, "value": "enum" }, { "type": "STRING", "value": "(" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "string" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "string" } ] } } ] }, { "type": "STRING", "value": ")" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[aA][sS]" }, "named": false, "value": "as" }, { "type": "STRING", "value": "(" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "var_declaration" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "var_declaration" } ] } } ] }, { "type": "STRING", "value": ")" } ] } ] }, { "type": "BLANK" } ] } ] }, "_with_query_statement": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "select_statement" }, { "type": "SYMBOL", "name": "insert_statement" }, { "type": "SYMBOL", "name": "delete_statement" }, { "type": "SYMBOL", "name": "update_statement" } ] }, "insert_statement": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "with_query" }, { "type": "BLANK" } ] }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][nN][sS][eE][rR][tT]" }, "named": false, "value": "insert" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][nN][tT][oO]" }, "named": false, "value": "into" }, { "type": "SYMBOL", "name": "identifier" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "as" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_list_of_identifiers" }, "named": true, "value": "columns" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "insert_items" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "insert_conflict" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "returning" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "into" }, { "type": "BLANK" } ] } ] }, "insert_items": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][eE][fF][aA][uU][lL][tT]" }, "named": false, "value": "default" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[vV][aA][lL][uU][eE][sS]" }, "named": false, "value": "values" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[vV][aA][lL][uU][eE][sS]" }, "named": false, "value": "values" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "insert_values" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "insert_values" } ] } } ] } ] }, { "type": "SYMBOL", "name": "select_statement" }, { "type": "SEQ", "members": [ { "type": "STRING", "value": "(" }, { "type": "SYMBOL", "name": "select_statement" }, { "type": "STRING", "value": ")" } ] } ] }, "insert_values": { "type": "SEQ", "members": [ { "type": "STRING", "value": "(" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "insert_item" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "insert_item" } ] } } ] }, { "type": "BLANK" } ] }, { "type": "STRING", "value": ")" } ] }, "insert_item": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][eE][fF][aA][uU][lL][tT]" }, "named": false, "value": "default" }, { "type": "SYMBOL", "name": "_value_expression" } ] }, "insert_conflict": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[oO][nN]" }, "named": false, "value": "on" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][oO][nN][fF][lL][iI][cC][tT]" }, "named": false, "value": "conflict" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "conflict_target" }, { "type": "BLANK" } ] }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][oO]" }, "named": false, "value": "do" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[nN][oO][tT][hH][iI][nN][gG]" }, "named": false, "value": "nothing" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[oO][nN]" }, "named": false, "value": "on" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][oO][nN][fF][lL][iI][cC][tT]" }, "named": false, "value": "conflict" }, { "type": "SYMBOL", "name": "conflict_target" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][oO]" }, "named": false, "value": "do" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[uU][pP][dD][aA][tT][eE]" }, "named": false, "value": "update" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[sS][eE][tT]" }, "named": false, "value": "set" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "update_set" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "update_set" } ] } } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "where_filter" }, { "type": "BLANK" } ] } ] } ] }, "conflict_target": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[oO][nN]" }, "named": false, "value": "on" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][oO][nN][sS][tT][rR][aA][iI][nN][tT]" }, "named": false, "value": "constraint" }, { "type": "SYMBOL", "name": "identifier" } ] }, { "type": "SEQ", "members": [ { "type": "STRING", "value": "(" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_value_expression" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "_value_expression" } ] } } ] }, { "type": "BLANK" } ] }, { "type": "STRING", "value": ")" } ] } ] }, "update_set": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "STRING", "value": "=" }, { "type": "SYMBOL", "name": "update_value" } ] }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_list_of_identifiers" }, { "type": "STRING", "value": "=" }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[rR][oO][wW]" }, "named": false, "value": "row" }, { "type": "BLANK" } ] }, { "type": "STRING", "value": "(" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "update_value" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "update_value" } ] } } ] }, { "type": "STRING", "value": ")" } ] } ] }, "update_value": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][eE][fF][aA][uU][lL][tT]" }, "named": false, "value": "default" }, { "type": "SYMBOL", "name": "_value_expression" } ] }, "returning": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[rR][eE][tT][uU][rR][nN][iI][nN][gG]" }, "named": false, "value": "returning" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "select_item" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "select_item" } ] } } ] } ] }, "create_table_statement": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][rR][eE][aA][tT][eE]" }, "named": false, "value": "create" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "temporary" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[uU][nN][lL][oO][gG][gG][eE][dD]" }, "named": false, "value": "unlogged" }, { "type": "BLANK" } ] }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[tT][aA][bB][lL][eE]" }, "named": false, "value": "table" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "if_not_exists" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "identifier" }, { "type": "STRING", "value": "(" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "create_table_item" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "create_table_item" } ] } } ] }, { "type": "BLANK" } ] }, { "type": "STRING", "value": ")" } ] }, "create_table_item": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "table_column_item" }, { "type": "SYMBOL", "name": "table_constraint" } ] }, "create_schema_statement": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][rR][eE][aA][tT][eE]" }, "named": false, "value": "create" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[sS][cC][hH][eE][mM][aA]" }, "named": false, "value": "schema" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "if_not_exists" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "schema_role" }, { "type": "BLANK" } ] } ] }, { "type": "SYMBOL", "name": "schema_role" } ] } ] }, "schema_role": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[aA][uU][tT][hH][oO][rR][iI][zZ][aA][tT][iI][oO][nN]" }, "named": false, "value": "authorization" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][uU][rR][rR][eE][nN][tT][__][uU][sS][eE][rR]" }, "named": false, "value": "current_user" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[sS][eE][sS][sS][iI][oO][nN][__][uU][sS][eE][rR]" }, "named": false, "value": "session_user" } ] } ] }, "create_index_statement": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][rR][eE][aA][tT][eE]" }, "named": false, "value": "create" }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[uU][nN][iI][qQ][uU][eE]" }, "named": false, "value": "unique" }, { "type": "BLANK" } ] }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][nN][dD][eE][xX]" }, "named": false, "value": "index" }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][oO][nN][cC][uU][rR][rR][eE][nN][tT][lL][yY]" }, "named": false, "value": "concurrently" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "if_not_exists" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "BLANK" } ] }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[oO][nN]" }, "named": false, "value": "on" }, { "type": "SYMBOL", "name": "identifier" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "index_using" }, { "type": "BLANK" } ] }, { "type": "STRING", "value": "(" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "index_col" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "index_col" } ] } } ] }, { "type": "STRING", "value": ")" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "index_includes" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "where_filter" }, { "type": "BLANK" } ] } ] }, "index_using": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[uU][sS][iI][nN][gG]" }, "named": false, "value": "using" }, { "type": "SYMBOL", "name": "identifier" } ] }, "index_col": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "index_col_dir" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "index_col_nulls" }, { "type": "BLANK" } ] } ] }, { "type": "SEQ", "members": [ { "type": "STRING", "value": "(" }, { "type": "SYMBOL", "name": "_value_expression" }, { "type": "STRING", "value": ")" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "index_col_dir" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "index_col_nulls" }, { "type": "BLANK" } ] } ] } ] }, "index_col_dir": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[aA][sS][cC]" }, "named": false, "value": "asc" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][eE][sS][cC]" }, "named": false, "value": "desc" } ] }, "index_col_nulls": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[nN][uU][lL][lL][sS]" }, "named": false, "value": "nulls" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[fF][iI][rR][sS][tT]" }, "named": false, "value": "first" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[nN][uU][lL][lL][sS]" }, "named": false, "value": "nulls" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[lL][aA][sS][tT]" }, "named": false, "value": "last" } ] } ] }, "index_includes": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][nN][cC][lL][uU][dD][eE]" }, "named": false, "value": "include" }, { "type": "SYMBOL", "name": "_list_of_identifiers" } ] }, "delete_statement": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "with_query" }, { "type": "BLANK" } ] }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][eE][lL][eE][tT][eE]" }, "named": false, "value": "delete" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[fF][rR][oO][mM]" }, "named": false, "value": "from" }, { "type": "SYMBOL", "name": "identifier" }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[aA][sS]" }, "named": false, "value": "as" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "delete_using" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "where_filter" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[rR][eE][tT][uU][rR][nN][iI][nN][gG]" }, "named": false, "value": "returning" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "select_item" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "select_item" } ] } } ] } ] }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "into" }, { "type": "BLANK" } ] } ] }, "delete_using": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[uU][sS][iI][nN][gG]" }, "named": false, "value": "using" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "from_item" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "from_item" } ] } } ] } ] }, "alter_table_statement": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[aA][lL][tT][eE][rR]" }, "named": false, "value": "alter" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[tT][aA][bB][lL][eE]" }, "named": false, "value": "table" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "if_exists" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "identifier" }, { "type": "SYMBOL", "name": "alter_table_change" } ] }, "alter_table_change": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "alter_table_action" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "alter_table_action" } ] } } ] }, { "type": "SYMBOL", "name": "alter_table_rename_column" }, { "type": "SYMBOL", "name": "alter_table_rename_constraint" }, { "type": "SYMBOL", "name": "alter_table_rename_table" }, { "type": "SYMBOL", "name": "alter_table_change_schema" } ] }, "alter_table_action": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[aA][dD][dD]" }, "named": false, "value": "add" }, { "type": "SYMBOL", "name": "table_constraint" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[aA][dD][dD]" }, "named": false, "value": "add" }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][oO][lL][uU][mM][nN]" }, "named": false, "value": "column" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "if_not_exists" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "table_column_item" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][rR][oO][pP]" }, "named": false, "value": "drop" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][oO][nN][sS][tT][rR][aA][iI][nN][tT]" }, "named": false, "value": "constraint" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "if_exists" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "identifier" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "alter_table_fk_ref_action" }, { "type": "BLANK" } ] } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][rR][oO][pP]" }, "named": false, "value": "drop" }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][oO][lL][uU][mM][nN]" }, "named": false, "value": "column" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "if_exists" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "identifier" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "alter_table_fk_ref_action" }, { "type": "BLANK" } ] } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[aA][lL][tT][eE][rR]" }, "named": false, "value": "alter" }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][oO][lL][uU][mM][nN]" }, "named": false, "value": "column" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "identifier" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "alter_column_action" }, { "type": "BLANK" } ] } ] } ] }, "alter_column_action": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[sS][eE][tT]" }, "named": false, "value": "set" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][eE][fF][aA][uU][lL][tT]" }, "named": false, "value": "default" }, { "type": "SYMBOL", "name": "_value_expression" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][rR][oO][pP]" }, "named": false, "value": "drop" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][eE][fF][aA][uU][lL][tT]" }, "named": false, "value": "default" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[sS][eE][tT]" }, "named": false, "value": "set" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[nN][oO][tT]" }, "named": false, "value": "not" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[nN][uU][lL][lL]" }, "named": false, "value": "null" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][rR][oO][pP]" }, "named": false, "value": "drop" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[nN][oO][tT]" }, "named": false, "value": "not" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[nN][uU][lL][lL]" }, "named": false, "value": "null" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[tT][yY][pP][eE]" }, "named": false, "value": "type" }, { "type": "SYMBOL", "name": "alter_column_type" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[sS][eE][tT]" }, "named": false, "value": "set" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][aA][tT][aA]" }, "named": false, "value": "data" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[tT][yY][pP][eE]" }, "named": false, "value": "type" }, { "type": "SYMBOL", "name": "alter_column_type" } ] } ] }, "table_constraint": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "table_constraint_ty" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "constraint_when" }, { "type": "BLANK" } ] } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][oO][nN][sS][tT][rR][aA][iI][nN][tT]" }, "named": false, "value": "constraint" }, { "type": "SYMBOL", "name": "identifier" }, { "type": "SYMBOL", "name": "table_constraint_ty" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "constraint_when" }, { "type": "BLANK" } ] } ] } ] }, "constraint_when": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][eE][fF][eE][rR][rR][aA][bB][lL][eE]" }, "named": false, "value": "deferrable" }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][eE][fF][eE][rR][rR][aA][bB][lL][eE]" }, "named": false, "value": "deferrable" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][nN][iI][tT][iI][aA][lL][lL][yY]" }, "named": false, "value": "initially" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][mM][mM][eE][dD][iI][aA][tT][eE]" }, "named": false, "value": "immediate" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][eE][fF][eE][rR][rR][aA][bB][lL][eE]" }, "named": false, "value": "deferrable" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][nN][iI][tT][iI][aA][lL][lL][yY]" }, "named": false, "value": "initially" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][eE][fF][eE][rR][rR][eE][dD]" }, "named": false, "value": "deferred" } ] } ] }, "table_constraint_ty": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][hH][eE][cC][kK]" }, "named": false, "value": "check" }, { "type": "STRING", "value": "(" }, { "type": "SYMBOL", "name": "_value_expression" }, { "type": "STRING", "value": ")" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[uU][nN][iI][qQ][uU][eE]" }, "named": false, "value": "unique" }, { "type": "SYMBOL", "name": "_list_of_identifiers" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[pP][rR][iI][mM][aA][rR][yY]" }, "named": false, "value": "primary" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[kK][eE][yY]" }, "named": false, "value": "key" }, { "type": "SYMBOL", "name": "_list_of_identifiers" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[fF][oO][rR][eE][iI][gG][nN]" }, "named": false, "value": "foreign" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[kK][eE][yY]" }, "named": false, "value": "key" }, { "type": "SYMBOL", "name": "_list_of_identifiers" }, { "type": "SYMBOL", "name": "constraint_foreign_key" } ] } ] }, "constraint_foreign_key": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[rR][eE][fF][eE][rR][eE][nN][cC][eE][sS]" }, "named": false, "value": "references" }, { "type": "SYMBOL", "name": "identifier" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_list_of_identifiers" }, { "type": "BLANK" } ] }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "fk_action" } } ] }, "fk_action": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[oO][nN]" }, "named": false, "value": "on" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][eE][lL][eE][tT][eE]" }, "named": false, "value": "delete" }, { "type": "SYMBOL", "name": "fk_ref_action" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[oO][nN]" }, "named": false, "value": "on" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[uU][pP][dD][aA][tT][eE]" }, "named": false, "value": "update" }, { "type": "SYMBOL", "name": "fk_ref_action" } ] } ] }, "fk_ref_action": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[nN][oO]" }, "named": false, "value": "no" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[aA][cC][tT][iI][oO][nN]" }, "named": false, "value": "action" } ] }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[rR][eE][sS][tT][rR][iI][cC][tT]" }, "named": false, "value": "restrict" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][aA][sS][cC][aA][dD][eE]" }, "named": false, "value": "cascade" }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[sS][eE][tT]" }, "named": false, "value": "set" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[nN][uU][lL][lL]" }, "named": false, "value": "null" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[sS][eE][tT]" }, "named": false, "value": "set" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][eE][fF][aA][uU][lL][tT]" }, "named": false, "value": "default" } ] } ] }, "alter_column_type": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_type" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[uU][sS][iI][nN][gG]" }, "named": false, "value": "using" }, { "type": "SYMBOL", "name": "_value_expression" } ] }, { "type": "BLANK" } ] } ] }, "alter_table_fk_ref_action": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[rR][eE][sS][tT][rR][iI][cC][tT]" }, "named": false, "value": "restrict" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][aA][sS][cC][aA][dD][eE]" }, "named": false, "value": "cascade" } ] }, "table_column_item": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "SYMBOL", "name": "_type" }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "column_constraint" } } ] }, "column_constraint": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][oO][nN][sS][tT][rR][aA][iI][nN][tT]" }, "named": false, "value": "constraint" }, { "type": "SYMBOL", "name": "identifier" }, { "type": "SYMBOL", "name": "column_constraint_ty" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "constraint_when" }, { "type": "BLANK" } ] } ] }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "column_constraint_ty" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "constraint_when" }, { "type": "BLANK" } ] } ] } ] }, "column_constraint_ty": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[nN][oO][tT]" }, "named": false, "value": "not" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[nN][uU][lL][lL]" }, "named": false, "value": "null" } ] }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[nN][uU][lL][lL]" }, "named": false, "value": "null" }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][hH][eE][cC][kK]" }, "named": false, "value": "check" }, { "type": "STRING", "value": "(" }, { "type": "SYMBOL", "name": "_value_expression" }, { "type": "STRING", "value": ")" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][eE][fF][aA][uU][lL][tT]" }, "named": false, "value": "default" }, { "type": "SYMBOL", "name": "_value_expression" } ] }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[uU][nN][iI][qQ][uU][eE]" }, "named": false, "value": "unique" }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[pP][rR][iI][mM][aA][rR][yY]" }, "named": false, "value": "primary" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[kK][eE][yY]" }, "named": false, "value": "key" } ] }, { "type": "SYMBOL", "name": "constraint_foreign_key" } ] }, "alter_table_rename_column": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[rR][eE][nN][aA][mM][eE]" }, "named": false, "value": "rename" }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][oO][lL][uU][mM][nN]" }, "named": false, "value": "column" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "identifier" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[tT][oO]" }, "named": false, "value": "to" }, { "type": "SYMBOL", "name": "identifier" } ] }, "alter_table_rename_constraint": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[rR][eE][nN][aA][mM][eE]" }, "named": false, "value": "rename" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][oO][nN][sS][tT][rR][aA][iI][nN][tT]" }, "named": false, "value": "constraint" }, { "type": "SYMBOL", "name": "identifier" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[tT][oO]" }, "named": false, "value": "to" }, { "type": "SYMBOL", "name": "identifier" } ] }, "alter_table_rename_table": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[rR][eE][nN][aA][mM][eE]" }, "named": false, "value": "rename" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[tT][oO]" }, "named": false, "value": "to" }, { "type": "SYMBOL", "name": "identifier" } ] }, "alter_table_change_schema": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[sS][eE][tT]" }, "named": false, "value": "set" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[sS][cC][hH][eE][mM][aA]" }, "named": false, "value": "schema" }, { "type": "SYMBOL", "name": "identifier" } ] }, "grant_statement": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[gG][rR][aA][nN][tT]" }, "named": false, "value": "grant" }, { "type": "SYMBOL", "name": "grant_privileges" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[oO][nN]" }, "named": false, "value": "on" }, { "type": "SYMBOL", "name": "grant_targets" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[tT][oO]" }, "named": false, "value": "to" }, { "type": "SYMBOL", "name": "grant_roles" } ] }, "grant_roles": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[pP][uU][bB][lL][iI][cC]" }, "named": false, "value": "public" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][uU][rR][rR][eE][nN][tT][__][uU][sS][eE][rR]" }, "named": false, "value": "current_user" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[sS][eE][sS][sS][iI][oO][nN][__][uU][sS][eE][rR]" }, "named": false, "value": "session_user" }, { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[gG][rR][oO][uU][pP]" }, "named": false, "value": "group" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "identifier" } ] } ] }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[pP][uU][bB][lL][iI][cC]" }, "named": false, "value": "public" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][uU][rR][rR][eE][nN][tT][__][uU][sS][eE][rR]" }, "named": false, "value": "current_user" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[sS][eE][sS][sS][iI][oO][nN][__][uU][sS][eE][rR]" }, "named": false, "value": "session_user" }, { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[gG][rR][oO][uU][pP]" }, "named": false, "value": "group" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "identifier" } ] } ] } ] } } ] }, "grant_privileges": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[aA][lL][lL]" }, "named": false, "value": "all" }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[pP][rR][iI][vV][iI][lL][eE][gG][eE][sS]" }, "named": false, "value": "privileges" }, { "type": "BLANK" } ] } ] }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "identifier" } ] } } ] } ] }, "grant_targets": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[aA][lL][lL]" }, "named": false, "value": "all" }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[tT][aA][bB][lL][eE][sS]" }, "named": false, "value": "tables" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[sS][eE][qQ][uU][eE][nN][cC][eE][sS]" }, "named": false, "value": "sequences" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[fF][uU][nN][cC][tT][iI][oO][nN][sS]" }, "named": false, "value": "functions" } ] }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][nN]" }, "named": false, "value": "in" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[sS][cC][hH][eE][mM][aA]" }, "named": false, "value": "schema" }, { "type": "SYMBOL", "name": "identifier" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[sS][eE][qQ][uU][eE][nN][cC][eE]" }, "named": false, "value": "sequence" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "identifier" } ] } } ] } ] }, { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[tT][aA][bB][lL][eE]" }, "named": false, "value": "table" }, { "type": "BLANK" } ] }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "identifier" } ] } } ] } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[sS][cC][hH][eE][mM][aA]" }, "named": false, "value": "schema" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "identifier" } ] } } ] } ] }, { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[fF][uU][nN][cC][tT][iI][oO][nN]" }, "named": false, "value": "function" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[pP][rR][oO][cC][eE][dD][uU][rR][eE]" }, "named": false, "value": "procedure" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[rR][oO][uU][tT][iI][nN][eE]" }, "named": false, "value": "routine" } ] }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "grant_function" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "grant_function" } ] } } ] } ] } ] }, "grant_function": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "STRING", "value": "(" }, { "type": "SEQ", "members": [ { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_type" } ] }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_type" } ] } ] } } ] }, { "type": "STRING", "value": ")" } ] }, "grant_all_in_schema": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][nN]" }, "named": false, "value": "in" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[sS][cC][hH][eE][mM][aA]" }, "named": false, "value": "schema" } ] }, "psql_statement": { "type": "SEQ", "members": [ { "type": "STRING", "value": "\\" }, { "type": "REPEAT1", "content": { "type": "SYMBOL", "name": "identifier" } }, { "type": "PATTERN", "value": "[\\n\\r]" } ] }, "create_sequence_statement": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][rR][eE][aA][tT][eE]" }, "named": false, "value": "create" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "temporary" }, { "type": "BLANK" } ] }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[sS][eE][qQ][uU][eE][nN][cC][eE]" }, "named": false, "value": "sequence" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "if_not_exists" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "identifier" }, { "type": "REPEAT", "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "as" }, { "type": "SYMBOL", "name": "sequence_increment" }, { "type": "SYMBOL", "name": "sequence_min" }, { "type": "SYMBOL", "name": "sequence_max" }, { "type": "SYMBOL", "name": "sequence_start" }, { "type": "SYMBOL", "name": "sequence_cache" }, { "type": "SYMBOL", "name": "sequence_cycle" }, { "type": "SYMBOL", "name": "sequence_owned" } ] } } ] }, "sequence_increment": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][nN][cC][rR][eE][mM][eE][nN][tT]" }, "named": false, "value": "increment" }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[bB][yY]" }, "named": false, "value": "by" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "number" } ] }, "sequence_min": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[nN][oO]" }, "named": false, "value": "no" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[mM][iI][nN][vV][aA][lL][uU][eE]" }, "named": false, "value": "minvalue" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[mM][iI][nN][vV][aA][lL][uU][eE]" }, "named": false, "value": "minvalue" }, { "type": "SYMBOL", "name": "number" } ] } ] }, "sequence_max": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[nN][oO]" }, "named": false, "value": "no" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[mM][aA][xX][vV][aA][lL][uU][eE]" }, "named": false, "value": "maxvalue" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[mM][aA][xX][vV][aA][lL][uU][eE]" }, "named": false, "value": "maxvalue" }, { "type": "SYMBOL", "name": "number" } ] } ] }, "sequence_start": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[sS][tT][aA][rR][tT]" }, "named": false, "value": "start" }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[wW][iI][tT][hH]" }, "named": false, "value": "with" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "number" } ] }, "sequence_cache": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][aA][cC][hH][eE]" }, "named": false, "value": "cache" }, { "type": "SYMBOL", "name": "number" } ] }, "sequence_cycle": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[nN][oO]" }, "named": false, "value": "no" }, { "type": "BLANK" } ] }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][yY][cC][lL][eE]" }, "named": false, "value": "cycle" } ] }, "sequence_owned": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[oO][wW][nN][eE][dD]" }, "named": false, "value": "owned" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[bB][yY]" }, "named": false, "value": "by" }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[nN][oO][nN][eE]" }, "named": false, "value": "none" }, { "type": "SYMBOL", "name": "identifier" } ] } ] }, "create_trigger_statement": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][rR][eE][aA][tT][eE]" }, "named": false, "value": "create" }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][oO][nN][sS][tT][rR][aA][iI][nN][tT]" }, "named": false, "value": "constraint" }, { "type": "BLANK" } ] }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[tT][rR][iI][gG][gG][eE][rR]" }, "named": false, "value": "trigger" }, { "type": "SYMBOL", "name": "identifier" }, { "type": "SYMBOL", "name": "trigger_when" }, { "type": "SYMBOL", "name": "trigger_event" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[oO][nN]" }, "named": false, "value": "on" }, { "type": "SYMBOL", "name": "identifier" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "trigger_scope" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "trigger_cond" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "trigger_exec" } ] }, "trigger_when": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[bB][eE][fF][oO][rR][eE]" }, "named": false, "value": "before" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[aA][fF][tT][eE][rR]" }, "named": false, "value": "after" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][nN][sS][tT][eE][aA][dD][ ][oO][fF]" }, "named": false, "value": "instead of" } ] }, "trigger_event": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][nN][sS][eE][rR][tT]" }, "named": false, "value": "insert" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[uU][pP][dD][aA][tT][eE]" }, "named": false, "value": "update" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][eE][lL][eE][tT][eE]" }, "named": false, "value": "delete" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[tT][rR][uU][nN][cC][aA][tT][eE]" }, "named": false, "value": "truncate" } ] }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[oO][rR]" }, "named": false, "value": "or" }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][nN][sS][eE][rR][tT]" }, "named": false, "value": "insert" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[uU][pP][dD][aA][tT][eE]" }, "named": false, "value": "update" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][eE][lL][eE][tT][eE]" }, "named": false, "value": "delete" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[tT][rR][uU][nN][cC][aA][tT][eE]" }, "named": false, "value": "truncate" } ] } ] } } ] }, "trigger_scope": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[fF][oO][rR]" }, "named": false, "value": "for" }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[eE][aA][cC][hH]" }, "named": false, "value": "each" }, { "type": "BLANK" } ] } ] }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[sS][tT][aA][tT][eE][mM][eE][nN][tT]" }, "named": false, "value": "statement" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[rR][oO][wW]" }, "named": false, "value": "row" } ] } ] }, "trigger_exec": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[eE][xX][eE][cC][uU][tT][eE]" }, "named": false, "value": "execute" }, { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[pP][rR][oO][cC][eE][dD][uU][rR][eE]" }, "named": false, "value": "procedure" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[fF][uU][nN][cC][tT][iI][oO][nN]" }, "named": false, "value": "function" } ] }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "function_call" } ] }, "trigger_cond": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[wW][hH][eE][nN]" }, "named": false, "value": "when" }, { "type": "STRING", "value": "(" }, { "type": "SYMBOL", "name": "_value_expression" }, { "type": "STRING", "value": ")" } ] }, "_plpgsql_statement": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_statement" }, { "type": "SYMBOL", "name": "assign_statement" }, { "type": "SYMBOL", "name": "get_diagnostics_statement" }, { "type": "SYMBOL", "name": "open_cursor_statement" }, { "type": "SYMBOL", "name": "return_statement" }, { "type": "SYMBOL", "name": "raise_statement" }, { "type": "SYMBOL", "name": "if_statement" }, { "type": "SYMBOL", "name": "for_statement" }, { "type": "SYMBOL", "name": "execute_statement" }, { "type": "SYMBOL", "name": "perform_statement" } ] }, { "type": "STRING", "value": ";" } ] }, "open_cursor_statement": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[oO][pP][eE][nN]" }, "named": false, "value": "open" }, { "type": "SYMBOL", "name": "identifier" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[fF][oO][rR]" }, "named": false, "value": "for" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "select_statement" }, { "type": "SYMBOL", "name": "execute_statement" } ] } ] }, "get_diagnostics_statement": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[gG][eE][tT]" }, "named": false, "value": "get" }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][uU][rR][rR][eE][nN][tT]" }, "named": false, "value": "current" }, { "type": "BLANK" } ] }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][iI][aA][gG][nN][oO][sS][tT][iI][cC][sS]" }, "named": false, "value": "diagnostics" }, { "type": "SYMBOL", "name": "assign_statement" } ] }, "for_statement": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[fF][oO][rR]" }, "named": false, "value": "for" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "identifier" } ] } } ] }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][nN]" }, "named": false, "value": "in" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[rR][eE][vV][eE][rR][sS][eE]" }, "named": false, "value": "reverse" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_value_expression" }, { "type": "STRING", "value": ".." }, { "type": "SYMBOL", "name": "_value_expression" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[bB][yY]" }, "named": false, "value": "by" }, { "type": "SYMBOL", "name": "_value_expression" } ] }, { "type": "BLANK" } ] } ] }, { "type": "SYMBOL", "name": "select_statement" }, { "type": "SYMBOL", "name": "execute_statement" } ] }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[lL][oO][oO][pP]" }, "named": false, "value": "loop" }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_plpgsql_statement" } }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[eE][nN][dD]" }, "named": false, "value": "end" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[lL][oO][oO][pP]" }, "named": false, "value": "loop" } ] }, "raise_statement": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[rR][aA][iI][sS][eE]" }, "named": false, "value": "raise" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "string" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_value_expression" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "_value_expression" } ] } } ] }, { "type": "BLANK" } ] } ] }, { "type": "BLANK" } ] } ] }, { "type": "BLANK" } ] } ] }, "if_statement": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][fF]" }, "named": false, "value": "if" }, { "type": "SYMBOL", "name": "_value_expression" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[tT][hH][eE][nN]" }, "named": false, "value": "then" }, { "type": "REPEAT1", "content": { "type": "SYMBOL", "name": "_plpgsql_statement" } }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[eE][lL][sS][iI][fF]" }, "named": false, "value": "elsif" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[eE][lL][sS][eE][iI][fF]" }, "named": false, "value": "elseif" } ] }, { "type": "SYMBOL", "name": "_value_expression" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[tT][hH][eE][nN]" }, "named": false, "value": "then" }, { "type": "REPEAT1", "content": { "type": "SYMBOL", "name": "_plpgsql_statement" } } ] } }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[eE][lL][sS][eE]" }, "named": false, "value": "else" }, { "type": "REPEAT1", "content": { "type": "SYMBOL", "name": "_plpgsql_statement" } } ] }, { "type": "BLANK" } ] }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[eE][nN][dD]" }, "named": false, "value": "end" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][fF]" }, "named": false, "value": "if" } ] }, "execute_statement": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[eE][xX][eE][cC][uU][tT][eE]" }, "named": false, "value": "execute" }, { "type": "SYMBOL", "name": "_value_expression" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "into" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "execute_using" }, { "type": "BLANK" } ] } ] }, "execute_using": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[uU][sS][iI][nN][gG]" }, "named": false, "value": "using" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_value_expression" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "_value_expression" } ] } } ] } ] }, "assign_statement": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "=" }, { "type": "STRING", "value": ":=" } ] }, { "type": "SYMBOL", "name": "_value_expression" } ] }, "return_statement": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[rR][eE][tT][uU][rR][nN]" }, "named": false, "value": "return" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[qQ][uU][eE][rR][yY]" }, "named": false, "value": "query" }, { "type": "SYMBOL", "name": "select_statement" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[qQ][uU][eE][rR][yY]" }, "named": false, "value": "query" }, { "type": "SYMBOL", "name": "execute_statement" } ] }, { "type": "SYMBOL", "name": "_value_expression" } ] } ] }, "perform_statement": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[pP][eE][rR][fF][oO][rR][mM]" }, "named": false, "value": "perform" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "select_item" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "select_item" } ] } } ] }, { "type": "BLANK" } ] } ] }, "do_block": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][oO]" }, "named": false, "value": "do" }, { "type": "SYMBOL", "name": "block" } ] }, "select_statement": { "type": "PREC_LEFT", "value": 0, "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "with_query" }, { "type": "BLANK" } ] }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[sS][eE][lL][eE][cC][tT]" }, "named": false, "value": "select" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "select_item" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "select_item" } ] } } ] }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "into" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "select_from" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "select_where" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "select_group_by" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "select_having" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "select_order_by" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_select_limit_offset" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "into" }, { "type": "BLANK" } ] } ] } }, "with_query": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[wW][iI][tT][hH]" }, "named": false, "value": "with" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "with_query_item" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "with_query_item" } ] } } ] } ] }, "with_query_item": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_list_of_identifiers" }, { "type": "BLANK" } ] }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[aA][sS]" }, "named": false, "value": "as" }, { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[mM][aA][tT][eE][rR][iI][aA][lL][iI][zZ][eE][dD]" }, "named": false, "value": "materialized" }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[nN][oO][tT]" }, "named": false, "value": "not" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[mM][aA][tT][eE][rR][iI][aA][lL][iI][zZ][eE][dD]" }, "named": false, "value": "materialized" } ] } ] }, { "type": "BLANK" } ] }, { "type": "STRING", "value": "(" }, { "type": "SYMBOL", "name": "_with_query_statement" }, { "type": "STRING", "value": ")" } ] }, "into": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][nN][tT][oO]" }, "named": false, "value": "into" }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[sS][tT][rR][iI][cC][tT]" }, "named": false, "value": "strict" }, { "type": "BLANK" } ] }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "identifier" } ] } } ] } ] }, "select_having": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[hH][aA][vV][iI][nN][gG]" }, "named": false, "value": "having" }, { "type": "SYMBOL", "name": "_value_expression" } ] }, "_select_limit_offset": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "select_limit" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "select_offset" }, { "type": "BLANK" } ] } ] }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "select_offset" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "select_limit" }, { "type": "BLANK" } ] } ] } ] }, "select_limit": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[lL][iI][mM][iI][tT]" }, "named": false, "value": "limit" }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[aA][lL][lL]" }, "named": false, "value": "all" }, { "type": "SYMBOL", "name": "_value_expression" } ] } ] }, "select_offset": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[oO][fF][fF][sS][eE][tT]" }, "named": false, "value": "offset" }, { "type": "SYMBOL", "name": "_value_expression" }, { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[rR][oO][wW]" }, "named": false, "value": "row" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[rR][oO][wW][sS]" }, "named": false, "value": "rows" } ] }, { "type": "BLANK" } ] } ] }, "select_group_by": { "type": "PREC", "value": 1, "content": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[gG][rR][oO][uU][pP]" }, "named": false, "value": "group" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[bB][yY]" }, "named": false, "value": "by" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "(" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_value_expression" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "_value_expression" } ] } } ] }, { "type": "STRING", "value": ")" } ] }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_value_expression" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "_value_expression" } ] } } ] } ] } ] } }, "select_order_by": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[oO][rR][dD][eE][rR]" }, "named": false, "value": "order" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[bB][yY]" }, "named": false, "value": "by" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "order_by_item" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "order_by_item" } ] } } ] } ] }, "order_by_item": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_value_expression" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "order_by_direction" }, { "type": "BLANK" } ] } ] }, "order_by_direction": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[aA][sS][cC]" }, "named": false, "value": "asc" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][eE][sS][cC]" }, "named": false, "value": "desc" } ] }, "select_where": { "type": "SYMBOL", "name": "where_filter" }, "select_item": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_value_expression" }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[aA][sS]" }, "named": false, "value": "as" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "BLANK" } ] } ] }, "select_from": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[fF][rR][oO][mM]" }, "named": false, "value": "from" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "from_item" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "from_item" } ] } } ] } ] }, "from_item": { "type": "PREC_LEFT", "value": 0, "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "from_select" }, { "type": "SYMBOL", "name": "from_table" }, { "type": "SYMBOL", "name": "from_function" } ] }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "join_item" } } ] } }, "from_select": { "type": "SEQ", "members": [ { "type": "STRING", "value": "(" }, { "type": "SYMBOL", "name": "select_statement" }, { "type": "STRING", "value": ")" }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[aA][sS]" }, "named": false, "value": "as" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "identifier" } ] }, "from_table": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[aA][sS]" }, "named": false, "value": "as" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "BLANK" } ] } ] }, "from_function": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "function_call" }, { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[aA][sS]" }, "named": false, "value": "as" }, { "type": "SYMBOL", "name": "identifier" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_list_of_identifiers" }, { "type": "BLANK" } ] } ] }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_list_of_identifiers" }, { "type": "BLANK" } ] } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[aA][sS]" }, "named": false, "value": "as" }, { "type": "SYMBOL", "name": "_list_of_identifiers" } ] } ] }, { "type": "BLANK" } ] } ] }, "join_item": { "type": "PREC_LEFT", "value": 0, "content": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[nN][aA][tT][uU][rR][aA][lL]" }, "named": false, "value": "natural" }, { "type": "SYMBOL", "name": "join_type" }, { "type": "SYMBOL", "name": "from_item" } ] }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "join_type" }, { "type": "SYMBOL", "name": "from_item" }, { "type": "SYMBOL", "name": "join_condition" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][rR][oO][sS][sS]" }, "named": false, "value": "cross" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[jJ][oO][iI][nN]" }, "named": false, "value": "join" }, { "type": "SYMBOL", "name": "from_item" } ] } ] } }, "join_condition": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[oO][nN]" }, "named": false, "value": "on" }, { "type": "SYMBOL", "name": "_value_expression" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[uU][sS][iI][nN][gG]" }, "named": false, "value": "using" }, { "type": "SYMBOL", "name": "_list_of_identifiers" } ] } ] }, "join_type": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][nN][nN][eE][rR]" }, "named": false, "value": "inner" }, { "type": "BLANK" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[lL][eE][fF][tT]" }, "named": false, "value": "left" }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[oO][uU][tT][eE][rR]" }, "named": false, "value": "outer" }, { "type": "BLANK" } ] } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[rR][iI][gG][hH][tT]" }, "named": false, "value": "right" }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[oO][uU][tT][eE][rR]" }, "named": false, "value": "outer" }, { "type": "BLANK" } ] } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[fF][uU][lL][lL]" }, "named": false, "value": "full" }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[oO][uU][tT][eE][rR]" }, "named": false, "value": "outer" }, { "type": "BLANK" } ] } ] } ] }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[jJ][oO][iI][nN]" }, "named": false, "value": "join" } ] }, "create_function_statement": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[cC][rR][eE][aA][tT][eE]" }, "named": false, "value": "create" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "or_replace" }, { "type": "BLANK" } ] }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[fF][uU][nN][cC][tT][iI][oO][nN]" }, "named": false, "value": "function" }, { "type": "SYMBOL", "name": "function_signature" }, { "type": "SYMBOL", "name": "function_return" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[aA][sS]" }, "named": false, "value": "as" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "block" }, { "type": "SYMBOL", "name": "string" } ] }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[lL][aA][nN][gG][uU][aA][gG][eE]" }, "named": false, "value": "language" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "SYMBOL", "name": "string" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "function_volatility" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "function_run_as" }, { "type": "BLANK" } ] } ] }, "function_run_as": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[sS][eE][cC][uU][rR][iI][tT][yY]" }, "named": false, "value": "security" }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][nN][vV][oO][kK][eE][rR]" }, "named": false, "value": "invoker" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][eE][fF][iI][nN][eE][rR]" }, "named": false, "value": "definer" } ] } ] }, "function_return": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[rR][eE][tT][uU][rR][nN][sS]" }, "named": false, "value": "returns" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_type" }, { "type": "SYMBOL", "name": "return_setof" }, { "type": "SYMBOL", "name": "return_table" } ] } ] }, "return_setof": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[sS][eE][tT][oO][fF]" }, "named": false, "value": "setof" }, { "type": "SYMBOL", "name": "_type" } ] }, "return_table": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[tT][aA][bB][lL][eE]" }, "named": false, "value": "table" }, { "type": "STRING", "value": "(" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "var_declaration" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "var_declaration" } ] } } ] }, { "type": "STRING", "value": ")" } ] }, "function_volatility": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][mM][mM][uU][tT][aA][bB][lL][eE]" }, "named": false, "value": "immutable" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[sS][tT][aA][bB][lL][eE]" }, "named": false, "value": "stable" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[vV][oO][lL][aA][tT][iI][lL][eE]" }, "named": false, "value": "volatile" } ] }, "block": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "dollar_quote" }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "declarations" } }, { "type": "SYMBOL", "name": "body" }, { "type": "SYMBOL", "name": "dollar_quote" } ] }, "body": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[bB][eE][gG][iI][nN]" }, "named": false, "value": "begin" }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_plpgsql_statement" } }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[eE][nN][dD]" }, "named": false, "value": "end" }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": ";" }, { "type": "BLANK" } ] } ] }, "dollar_quote": { "type": "SEQ", "members": [ { "type": "STRING", "value": "$" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "BLANK" } ] }, { "type": "STRING", "value": "$" } ] }, "declarations": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][eE][cC][lL][aA][rR][eE]" }, "named": false, "value": "declare" }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "var_definition" } } ] }, "var_definition": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "var_declaration" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": ":=" }, { "type": "SYMBOL", "name": "_value_expression" } ] }, { "type": "BLANK" } ] }, { "type": "STRING", "value": ";" } ] }, "function_signature": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "SYMBOL", "name": "function_parameters" } ] }, "function_parameters": { "type": "SEQ", "members": [ { "type": "STRING", "value": "(" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "var_declaration" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "var_declaration" } ] } } ] }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][eE][fF][aA][uU][lL][tT]" }, "named": false, "value": "default" }, { "type": "FIELD", "name": "default_value", "content": { "type": "SYMBOL", "name": "_value_expression" } } ] }, { "type": "BLANK" } ] }, { "type": "STRING", "value": ")" } ] }, "var_declaration": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "name", "content": { "type": "SYMBOL", "name": "identifier" } }, { "type": "FIELD", "name": "type", "content": { "type": "SYMBOL", "name": "_type" } } ] }, "where_filter": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[wW][hH][eE][rR][eE]" }, "named": false, "value": "where" }, { "type": "SYMBOL", "name": "_value_expression" } ] }, "or_replace": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[oO][rR]" }, "named": false, "value": "or" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[rR][eE][pP][lL][aA][cC][eE]" }, "named": false, "value": "replace" } ] }, "temporary": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[tT][eE][mM][pP]" }, "named": false, "value": "temp" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[tT][eE][mM][pP][oO][rR][aA][rR][yY]" }, "named": false, "value": "temporary" } ] }, "if_not_exists": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][fF]" }, "named": false, "value": "if" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[nN][oO][tT]" }, "named": false, "value": "not" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[eE][xX][iI][sS][tT][sS]" }, "named": false, "value": "exists" } ] }, "if_exists": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][fF]" }, "named": false, "value": "if" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[eE][xX][iI][sS][tT][sS]" }, "named": false, "value": "exists" } ] }, "as": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[aA][sS]" }, "named": false, "value": "as" }, { "type": "SYMBOL", "name": "identifier" } ] }, "_type": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "predefined_types" }, { "type": "SYMBOL", "name": "identifier" } ] }, { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "[" }, { "type": "STRING", "value": "]" } ] } }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[%%][rR][oO][wW][tT][yY][pP][eE]" }, "named": false, "value": "%rowtype" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[%%][tT][yY][pP][eE]" }, "named": false, "value": "%type" } ] }, { "type": "BLANK" } ] } ] }, "predefined_types": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[nN][uU][mM][eE][rR][iI][cC]" }, "named": false, "value": "numeric" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "precision" }, { "type": "BLANK" } ] } ] } ] }, "precision": { "type": "SEQ", "members": [ { "type": "STRING", "value": "(" }, { "type": "SYMBOL", "name": "number" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "number" } ] }, { "type": "BLANK" } ] }, { "type": "STRING", "value": ")" } ] }, "string": { "type": "SEQ", "members": [ { "type": "STRING", "value": "'" }, { "type": "REPEAT", "content": { "type": "CHOICE", "members": [ { "type": "PREC", "value": 1, "content": { "type": "PATTERN", "value": "''" } }, { "type": "PREC", "value": 2, "content": { "type": "PATTERN", "value": "[^']" } } ] } }, { "type": "STRING", "value": "'" } ] }, "comment": { "type": "TOKEN", "content": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "--" }, { "type": "PATTERN", "value": ".*" } ] }, { "type": "SEQ", "members": [ { "type": "STRING", "value": "/*" }, { "type": "PATTERN", "value": "[^*]*\\*+([^/*][^*]*\\*+)*" }, { "type": "STRING", "value": "/" } ] } ] } }, "_value_expression": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "number" }, { "type": "SYMBOL", "name": "dollar_quote_string" }, { "type": "SYMBOL", "name": "string" }, { "type": "SYMBOL", "name": "true" }, { "type": "SYMBOL", "name": "false" }, { "type": "SYMBOL", "name": "null" }, { "type": "SYMBOL", "name": "star" }, { "type": "SEQ", "members": [ { "type": "STRING", "value": "(" }, { "type": "SYMBOL", "name": "select_statement" }, { "type": "STRING", "value": ")" } ] }, { "type": "SEQ", "members": [ { "type": "STRING", "value": "(" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_value_expression" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "_value_expression" } ] } } ] }, { "type": "STRING", "value": ")" } ] }, { "type": "SYMBOL", "name": "function_call" }, { "type": "SYMBOL", "name": "array_constructor" }, { "type": "SYMBOL", "name": "op_expression" }, { "type": "SYMBOL", "name": "time_expression" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "STRING", "value": "." }, { "type": "SYMBOL", "name": "star" } ] }, { "type": "SYMBOL", "name": "identifier" } ] }, "array_constructor": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[aA][rR][rR][aA][yY]" }, "named": false, "value": "array" }, { "type": "STRING", "value": "[" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_value_expression" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "_value_expression" } ] } } ] }, { "type": "BLANK" } ] }, { "type": "STRING", "value": "]" } ] }, "dollar_quote_string": { "type": "SEQ", "members": [ { "type": "STRING", "value": "$" }, { "type": "SYMBOL", "name": "_identifier" }, { "type": "STRING", "value": "$" }, { "type": "PATTERN", "value": "(([^$]+)|(%\\d+\\$[sI])|(\\$\\d+))+" }, { "type": "STRING", "value": "$" }, { "type": "SYMBOL", "name": "_identifier" }, { "type": "STRING", "value": "$" } ] }, "time_expression": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[aA][tT]" }, "named": false, "value": "at" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[tT][iI][mM][eE]" }, "named": false, "value": "time" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[zZ][oO][nN][eE]" }, "named": false, "value": "zone" }, { "type": "SYMBOL", "name": "_value_expression" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][nN][tT][eE][rR][vV][aA][lL]" }, "named": false, "value": "interval" }, { "type": "SYMBOL", "name": "string" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_interval_fields" }, { "type": "BLANK" } ] } ] } ] }, "_interval_fields": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[yY][eE][aA][rR]" }, "named": false, "value": "year" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[mM][oO][nN][tT][hH]" }, "named": false, "value": "month" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][aA][yY]" }, "named": false, "value": "day" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[hH][oO][uU][rR]" }, "named": false, "value": "hour" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[mM][iI][nN][uU][tT][eE]" }, "named": false, "value": "minute" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[sS][eE][cC][oO][nN][dD]" }, "named": false, "value": "second" }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[yY][eE][aA][rR]" }, "named": false, "value": "year" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[tT][oO]" }, "named": false, "value": "to" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[mM][oO][nN][tT][hH]" }, "named": false, "value": "month" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][aA][yY]" }, "named": false, "value": "day" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[tT][oO]" }, "named": false, "value": "to" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[hH][oO][uU][rR]" }, "named": false, "value": "hour" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][aA][yY]" }, "named": false, "value": "day" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[tT][oO]" }, "named": false, "value": "to" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[mM][iI][nN][uU][tT][eE]" }, "named": false, "value": "minute" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[dD][aA][yY]" }, "named": false, "value": "day" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[tT][oO]" }, "named": false, "value": "to" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[sS][eE][cC][oO][nN][dD]" }, "named": false, "value": "second" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[hH][oO][uU][rR]" }, "named": false, "value": "hour" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[tT][oO]" }, "named": false, "value": "to" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[mM][iI][nN][uU][tT][eE]" }, "named": false, "value": "minute" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[hH][oO][uU][rR]" }, "named": false, "value": "hour" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[tT][oO]" }, "named": false, "value": "to" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[sS][eE][cC][oO][nN][dD]" }, "named": false, "value": "second" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[mM][iI][nN][uU][tT][eE]" }, "named": false, "value": "minute" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[tT][oO]" }, "named": false, "value": "to" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[sS][eE][cC][oO][nN][dD]" }, "named": false, "value": "second" } ] } ] }, "function_call": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "STRING", "value": "(" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "select_statement" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_value_expression" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "_value_expression" } ] } } ] }, { "type": "BLANK" } ] } ] }, { "type": "STRING", "value": ")" } ] }, "op_expression": { "type": "CHOICE", "members": [ { "type": "PREC_LEFT", "value": 12, "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_value_expression" }, { "type": "SYMBOL", "name": "cast" }, { "type": "SYMBOL", "name": "_type" } ] } }, { "type": "PREC_RIGHT", "value": 10, "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "minus" }, { "type": "SYMBOL", "name": "plus" } ] }, { "type": "SYMBOL", "name": "_value_expression" } ] } }, { "type": "PREC_LEFT", "value": 8, "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_value_expression" }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "*" }, { "type": "STRING", "value": "/" }, { "type": "STRING", "value": "%" } ] }, { "type": "SYMBOL", "name": "_value_expression" } ] } }, { "type": "PREC_LEFT", "value": 7, "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_value_expression" }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "-" }, { "type": "STRING", "value": "+" } ] }, { "type": "SYMBOL", "name": "_value_expression" } ] } }, { "type": "PREC_LEFT", "value": 6, "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_value_expression" }, { "type": "SYMBOL", "name": "other_op" }, { "type": "SYMBOL", "name": "_value_expression" } ] } }, { "type": "PREC_LEFT", "value": 5, "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_value_expression" }, { "type": "SYMBOL", "name": "contains_op" }, { "type": "SYMBOL", "name": "_value_expression" } ] } }, { "type": "PREC_LEFT", "value": 4, "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_value_expression" }, { "type": "SYMBOL", "name": "comparison_op" }, { "type": "SYMBOL", "name": "_value_expression" } ] } }, { "type": "PREC_LEFT", "value": 3, "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_value_expression" }, { "type": "SYMBOL", "name": "comparison_kw" }, { "type": "SYMBOL", "name": "_value_expression" } ] } }, { "type": "PREC_LEFT", "value": 3, "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_value_expression" }, { "type": "SYMBOL", "name": "comparison_null" } ] } }, { "type": "PREC_RIGHT", "value": 2, "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "not" }, { "type": "SYMBOL", "name": "_value_expression" } ] } }, { "type": "PREC_LEFT", "value": 1, "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_value_expression" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "and" }, { "type": "SYMBOL", "name": "or" } ] }, { "type": "SYMBOL", "name": "_value_expression" } ] } } ] }, "_list_of_identifiers": { "type": "SEQ", "members": [ { "type": "STRING", "value": "(" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "identifier" } ] } } ] }, { "type": "BLANK" } ] }, { "type": "STRING", "value": ")" } ] }, "comparison_op": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "<" }, { "type": "STRING", "value": ">" }, { "type": "STRING", "value": "=" }, { "type": "STRING", "value": "<=" }, { "type": "STRING", "value": ">=" }, { "type": "STRING", "value": "<>" }, { "type": "STRING", "value": "!=" } ] }, "contains_op": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[bB][eE][tT][wW][eE][eE][nN]" }, "named": false, "value": "between" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][nN]" }, "named": false, "value": "in" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[lL][iI][kK][eE]" }, "named": false, "value": "like" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][lL][iI][kK][eE]" }, "named": false, "value": "ilike" } ] }, "comparison_null": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][sS][ ][nN][uU][lL][lL]" }, "named": false, "value": "is null" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][sS][nN][uU][lL][lL]" }, "named": false, "value": "isnull" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][sS][ ][nN][oO][tT][ ][nN][uU][lL][lL]" }, "named": false, "value": "is not null" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[nN][oO][tT][nN][uU][lL][lL]" }, "named": false, "value": "notnull" } ] }, "comparison_kw": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][sS]" }, "named": false, "value": "is" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][sS][ ][dD][iI][sS][tT][iI][nN][cC][tT][ ][fF][rR][oO][mM]" }, "named": false, "value": "is distinct from" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[iI][sS][ ][nN][oO][tT][ ][dD][iI][sS][tT][iI][nN][cC][tT][ ][fF][rR][oO][mM]" }, "named": false, "value": "is not distinct from" } ] }, "other_op": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "||" }, { "type": "STRING", "value": "<@" }, { "type": "STRING", "value": "@>" }, { "type": "STRING", "value": "<<" }, { "type": "STRING", "value": ">>" }, { "type": "STRING", "value": "&&" }, { "type": "STRING", "value": "&<" }, { "type": "STRING", "value": "&>" }, { "type": "STRING", "value": "-|-" } ] }, "cast": { "type": "STRING", "value": "::" }, "minus": { "type": "STRING", "value": "-" }, "plus": { "type": "STRING", "value": "+" }, "not": { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[nN][oO][tT]" }, "named": false, "value": "not" }, "and": { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[aA][nN][dD]" }, "named": false, "value": "and" }, "or": { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[oO][rR]" }, "named": false, "value": "or" }, "true": { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[tT][rR][uU][eE]" }, "named": false, "value": "true" }, "false": { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[fF][aA][lL][sS][eE]" }, "named": false, "value": "false" }, "null": { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[nN][uU][lL][lL]" }, "named": false, "value": "null" }, "star": { "type": "STRING", "value": "*" }, "any": { "type": "PATTERN", "value": ".*" }, "number": { "type": "PATTERN", "value": "-?\\d+" }, "identifier": { "type": "SYMBOL", "name": "_identifier" }, "_identifier": { "type": "PATTERN", "value": "[a-zA-Z0-9_]+(\\.?[a-zA-Z0-9_]+)*" } }, "extras": [ { "type": "SYMBOL", "name": "comment" }, { "type": "PATTERN", "value": "[\\s\\uFEFF\\u2060\\u200B\\u00A0]" } ], "conflicts": [], "precedences": [], "externals": [], "inline": [], "supertypes": [] }