HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulepostgresql-syntax-0.4.1.1Haskell2010

PostgresqlSyntax.Ast

Names for nodes mostly resemble the according definitions in the gram.y original Postgres parser file, except for the cases where we can optimize on that.

For reasoning see the docs of the parsing module of this project.

  • 173 types

Statement

1 declaration
datadata PreparableStmt
#
References
PreparableStmt:
  |  SelectStmt
  |  InsertStmt
  |  UpdateStmt
  |  DeleteStmt
  |  CallStmt
Instances5Eq, Ord, Show, Generic, Rep

Call

1 declaration
newtypenewtype CallStmt
#
Instances5Eq, Ord, Show, Generic, Rep

Insert

10 declarations
datadata InsertStmt
#
References
InsertStmt:
  | opt_with_clause INSERT INTO insert_target insert_rest
      opt_on_conflict returning_clause
Instances5Eq, Ord, Show, Generic, Rep
datadata InsertTarget
#
References
insert_target:
  | qualified_name
  | qualified_name AS ColId
Instances5Eq, Ord, Show, Generic, Rep
datadata InsertRest
#
References
insert_rest:
  | SelectStmt
  | OVERRIDING override_kind VALUE_P SelectStmt
  | '(' insert_column_list ')' SelectStmt
  | '(' insert_column_list ')' OVERRIDING override_kind VALUE_P SelectStmt
  | DEFAULT VALUES
Instances5Eq, Ord, Show, Generic, Rep
datadata OverrideKind
#
References
override_kind:
  | USER
  | SYSTEM_P
Instances7Bounded, Enum, Eq, Ord, Show, Generic, …
datadata InsertColumnItem
#
References
insert_column_item:
  | ColId opt_indirection
Instances5Eq, Ord, Show, Generic, Rep
datadata OnConflict
#
References
opt_on_conflict:
  | ON CONFLICT opt_conf_expr DO UPDATE SET set_clause_list where_clause
  | ON CONFLICT opt_conf_expr DO NOTHING
  | EMPTY
Instances5Eq, Ord, Show, Generic, Rep
datadata OnConflictDo
#
References
opt_on_conflict:
  | ON CONFLICT opt_conf_expr DO UPDATE SET set_clause_list where_clause
  | ON CONFLICT opt_conf_expr DO NOTHING
  | EMPTY
Instances5Eq, Ord, Show, Generic, Rep
datadata ConfExpr
#
References
opt_conf_expr:
  | '(' index_params ')' where_clause
  | ON CONSTRAINT name
  | EMPTY
Instances5Eq, Ord, Show, Generic, Rep

Update

5 declarations
datadata UpdateStmt
#
References
UpdateStmt:
  | opt_with_clause UPDATE relation_expr_opt_alias
      SET set_clause_list
      from_clause
      where_or_current_clause
      returning_clause
Instances5Eq, Ord, Show, Generic, Rep
datadata SetClause
#
References
set_clause:
  | set_target = a_expr
  | '(' set_target_list ')' = a_expr
Instances5Eq, Ord, Show, Generic, Rep
datadata SetTarget
#
References
set_target:
  | ColId opt_indirection
Instances5Eq, Ord, Show, Generic, Rep

Delete

2 declarations
datadata DeleteStmt
#
References
DeleteStmt:
  | opt_with_clause DELETE_P FROM relation_expr_opt_alias
      using_clause where_or_current_clause returning_clause
Instances5Eq, Ord, Show, Generic, Rep

Select

35 declarations
datadata SelectWithParens
#
References
select_with_parens:
  |  '(' select_no_parens ')'
  |  '(' select_with_parens ')'
Instances5Eq, Ord, Show, Generic, Rep
datadata SelectNoParens
#

Covers the following cases:

select_no_parens:
  |  simple_select
  |  select_clause sort_clause
  |  select_clause opt_sort_clause for_locking_clause opt_select_limit
  |  select_clause opt_sort_clause select_limit opt_for_locking_clause
  |  with_clause select_clause
  |  with_clause select_clause sort_clause
  |  with_clause select_clause opt_sort_clause for_locking_clause opt_select_limit
  |  with_clause select_clause opt_sort_clause select_limit opt_for_locking_clause
Instances5Eq, Ord, Show, Generic, Rep
datadata SimpleSelect
#
References
simple_select:
  |  SELECT opt_all_clause opt_target_list
      into_clause from_clause where_clause
      group_clause having_clause window_clause
  |  SELECT distinct_clause target_list
      into_clause from_clause where_clause
      group_clause having_clause window_clause
  |  values_clause
  |  TABLE relation_expr
  |  select_clause UNION all_or_distinct select_clause
  |  select_clause INTERSECT all_or_distinct select_clause
  |  select_clause EXCEPT all_or_distinct select_clause
Instances5Eq, Ord, Show, Generic, Rep
datadata Targeting
#

Covers these parts of spec:

References
simple_select:
  |  SELECT opt_all_clause opt_target_list
      into_clause from_clause where_clause
      group_clause having_clause window_clause
  |  SELECT distinct_clause target_list
      into_clause from_clause where_clause
      group_clause having_clause window_clause

distinct_clause:
  |  DISTINCT
  |  DISTINCT ON '(' expr_list ')'
Instances5Eq, Ord, Show, Generic, Rep
datadata TargetEl
#
References
target_el:
  |  a_expr AS ColLabel
  |  a_expr IDENT
  |  a_expr
  |  *
Instances5Eq, Ord, Show, Generic, Rep
datadata SelectBinOp
#
References
  |  select_clause UNION all_or_distinct select_clause
  |  select_clause INTERSECT all_or_distinct select_clause
  |  select_clause EXCEPT all_or_distinct select_clause
Instances5Eq, Ord, Show, Generic, Rep
datadata WithClause
#
References
with_clause:
  |  WITH cte_list
  |  WITH_LA cte_list
  |  WITH RECURSIVE cte_list
Instances5Eq, Ord, Show, Generic, Rep
datadata CommonTableExpr
#
References
common_table_expr:
  |  name opt_name_list AS opt_materialized '(' PreparableStmt ')'
opt_materialized:
  | MATERIALIZED
  | NOT MATERIALIZED
  | EMPTY
Instances5Eq, Ord, Show, Generic, Rep
datadata OptTempTableName
#
References
OptTempTableName:
  |  TEMPORARY opt_table qualified_name
  |  TEMP opt_table qualified_name
  |  LOCAL TEMPORARY opt_table qualified_name
  |  LOCAL TEMP opt_table qualified_name
  |  GLOBAL TEMPORARY opt_table qualified_name
  |  GLOBAL TEMP opt_table qualified_name
  |  UNLOGGED opt_table qualified_name
  |  TABLE qualified_name
  |  qualified_name
Instances5Eq, Ord, Show, Generic, Rep
datadata GroupByItem
#
References
group_by_item:
  |  a_expr
  |  empty_grouping_set
  |  cube_clause
  |  rollup_clause
  |  grouping_sets_clause
empty_grouping_set:
  |  '(' ')'
rollup_clause:
  |  ROLLUP '(' expr_list ')'
cube_clause:
  |  CUBE '(' expr_list ')'
grouping_sets_clause:
  |  GROUPING SETS '(' group_by_list ')'
Instances5Eq, Ord, Show, Generic, Rep
window_clause:
  |  WINDOW window_definition_list
  |  EMPTY

window_definition_list:
  |  window_definition
  |  window_definition_list ',' window_definition
datadata WindowDefinition
#
window_definition:
  |  ColId AS window_specification
Instances5Eq, Ord, Show, Generic, Rep
datadata WindowSpecification
#
window_specification:
  |  '(' opt_existing_window_name opt_partition_clause
            opt_sort_clause opt_frame_clause ')'

opt_existing_window_name:
  |  ColId
  |  EMPTY

opt_partition_clause:
  |  PARTITION BY expr_list
  |  EMPTY
Instances5Eq, Ord, Show, Generic, Rep
datadata FrameClause
#
References
opt_frame_clause:
  |  RANGE frame_extent opt_window_exclusion_clause
  |  ROWS frame_extent opt_window_exclusion_clause
  |  GROUPS frame_extent opt_window_exclusion_clause
  |  EMPTY
Instances5Eq, Ord, Show, Generic, Rep
datadata FrameClauseMode
#
References
opt_frame_clause:
  |  RANGE frame_extent opt_window_exclusion_clause
  |  ROWS frame_extent opt_window_exclusion_clause
  |  GROUPS frame_extent opt_window_exclusion_clause
  |  EMPTY
Instances5Eq, Ord, Show, Generic, Rep
datadata FrameExtent
#
References
frame_extent:
  |  frame_bound
  |  BETWEEN frame_bound AND frame_bound
Instances5Eq, Ord, Show, Generic, Rep
datadata FrameBound
#
References
frame_bound:
  |  UNBOUNDED PRECEDING
  |  UNBOUNDED FOLLOWING
  |  CURRENT_P ROW
  |  a_expr PRECEDING
  |  a_expr FOLLOWING
Instances5Eq, Ord, Show, Generic, Rep
References
opt_window_exclusion_clause:
  |  EXCLUDE CURRENT_P ROW
  |  EXCLUDE GROUP_P
  |  EXCLUDE TIES
  |  EXCLUDE NO OTHERS
  |  EMPTY
Instances5Eq, Ord, Show, Generic, Rep
datadata SortBy
#
References
sortby:
  |  a_expr USING qual_all_Op opt_nulls_order
  |  a_expr opt_asc_desc opt_nulls_order
Instances5Eq, Ord, Show, Generic, Rep
datadata SelectLimit
#
References
select_limit:
  | limit_clause offset_clause
  | offset_clause limit_clause
  | limit_clause
  | offset_clause
Instances5Eq, Ord, Show, Generic, Rep
datadata LimitClause
#
References
limit_clause:
  | LIMIT select_limit_value
  | LIMIT select_limit_value ',' select_offset_value
  | FETCH first_or_next select_fetch_first_value row_or_rows ONLY
  | FETCH first_or_next row_or_rows ONLY
select_offset_value:
  | a_expr
first_or_next:
  | FIRST_P
  | NEXT
row_or_rows:
  | ROW
  | ROWS
Instances5Eq, Ord, Show, Generic, Rep
References
select_fetch_first_value:
  | c_expr
  | + I_or_F_const
  | - I_or_F_const
Instances5Eq, Ord, Show, Generic, Rep
datadata SelectLimitValue
#
References
select_limit_value:
  | a_expr
  | ALL
Instances5Eq, Ord, Show, Generic, Rep
datadata OffsetClause
#
References
offset_clause:
  | OFFSET select_offset_value
  | OFFSET select_fetch_first_value row_or_rows
select_offset_value:
  | a_expr
row_or_rows:
  | ROW
  | ROWS
Instances5Eq, Ord, Show, Generic, Rep

For Locking

3 declarations
datadata ForLockingClause
#
References
for_locking_clause:
  | for_locking_items
  | FOR READ ONLY
for_locking_items:
  | for_locking_item
  | for_locking_items for_locking_item
Instances5Eq, Ord, Show, Generic, Rep
datadata ForLockingItem
#
References
for_locking_item:
  | for_locking_strength locked_rels_list opt_nowait_or_skip
locked_rels_list:
  | OF qualified_name_list
  | EMPTY
opt_nowait_or_skip:
  | NOWAIT
  | SKIP LOCKED
  | EMPTY
Instances5Eq, Ord, Show, Generic, Rep
datadata ForLockingStrength
#
References
for_locking_strength:
  | FOR UPDATE
  | FOR NO KEY UPDATE
  | FOR SHARE
  | FOR KEY SHARE
Instances5Eq, Ord, Show, Generic, Rep

Table references and joining

20 declarations
datadata TableRef
#
References
| relation_expr opt_alias_clause
| relation_expr opt_alias_clause tablesample_clause
| func_table func_alias_clause
| LATERAL_P func_table func_alias_clause
| xmltable opt_alias_clause
| LATERAL_P xmltable opt_alias_clause
| select_with_parens opt_alias_clause
| LATERAL_P select_with_parens opt_alias_clause
| joined_table
| '(' joined_table ')' alias_clause

TODO: Add xmltable

Constructors

Instances5Eq, Ord, Show, Generic, Rep
datadata RelationExpr
#
References
| qualified_name
| qualified_name *
| ONLY qualified_name
| ONLY '(' qualified_name ')'
Instances5Eq, Ord, Show, Generic, Rep
datadata RelationExprOptAlias
#
References
relation_expr_opt_alias:
  | relation_expr
  | relation_expr ColId
  | relation_expr AS ColId
Instances5Eq, Ord, Show, Generic, Rep
datadata TablesampleClause
#
References
tablesample_clause:
  | TABLESAMPLE func_name '(' expr_list ')' opt_repeatable_clause
Instances5Eq, Ord, Show, Generic, Rep
datadata FuncTable
#
References
func_table:
  | func_expr_windowless opt_ordinality
  | ROWS FROM '(' rowsfrom_list ')' opt_ordinality
Instances5Eq, Ord, Show, Generic, Rep
datadata RowsfromItem
#
References
rowsfrom_item:
  | func_expr_windowless opt_col_def_list
Instances5Eq, Ord, Show, Generic, Rep
typetype OptOrdinality = Bool
#
References
opt_ordinality:
  | WITH_LA ORDINALITY
  | EMPTY
datadata TableFuncElement
#
References
TableFuncElement:
  | ColId Typename opt_collate_clause
Instances5Eq, Ord, Show, Generic, Rep
datadata AliasClause
#
References
alias_clause:
  |  AS ColId '(' name_list ')'
  |  AS ColId
  |  ColId '(' name_list ')'
  |  ColId
Instances5Eq, Ord, Show, Generic, Rep
datadata FuncAliasClause
#
References
func_alias_clause:
  | alias_clause
  | AS '(' TableFuncElementList ')'
  | AS ColId '(' TableFuncElementList ')'
  | ColId '(' TableFuncElementList ')'
  | EMPTY
Instances5Eq, Ord, Show, Generic, Rep
datadata JoinedTable
#
References
| '(' joined_table ')'
| table_ref CROSS JOIN table_ref
| table_ref join_type JOIN table_ref join_qual
| table_ref JOIN table_ref join_qual
| table_ref NATURAL join_type JOIN table_ref
| table_ref NATURAL JOIN table_ref

The options are covered by the JoinMeth type.
Instances5Eq, Ord, Show, Generic, Rep
datadata JoinMeth
#
References
| table_ref CROSS JOIN table_ref
| table_ref join_type JOIN table_ref join_qual
| table_ref JOIN table_ref join_qual
| table_ref NATURAL join_type JOIN table_ref
| table_ref NATURAL JOIN table_ref
Instances5Eq, Ord, Show, Generic, Rep
datadata JoinType
#
References
| FULL join_outer
| LEFT join_outer
| RIGHT join_outer
| INNER_P
Instances5Eq, Ord, Show, Generic, Rep
datadata JoinQual
#
References
join_qual:
  |  USING '(' name_list ')'
  |  ON a_expr
Instances5Eq, Ord, Show, Generic, Rep

Where

2 declarations
datadata WhereOrCurrentClause
#
References
| WHERE a_expr
| WHERE CURRENT_P OF cursor_name
| *EMPTY*
Instances5Eq, Ord, Show, Generic, Rep

Expression

36 declarations
datadata AExpr
#
References
a_expr:
  | c_expr
  | a_expr TYPECAST Typename
  | a_expr COLLATE any_name
  | a_expr AT TIME ZONE a_expr
  | + a_expr
  | - a_expr
  | a_expr + a_expr
  | a_expr - a_expr
  | a_expr * a_expr
  | a_expr / a_expr
  | a_expr % a_expr
  | a_expr ^ a_expr
  | a_expr < a_expr
  | a_expr > a_expr
  | a_expr = a_expr
  | a_expr LESS_EQUALS a_expr
  | a_expr GREATER_EQUALS a_expr
  | a_expr NOT_EQUALS a_expr
  | a_expr qual_Op a_expr
  | qual_Op a_expr
  | a_expr qual_Op
  | a_expr AND a_expr
  | a_expr OR a_expr
  | NOT a_expr
  | NOT_LA a_expr
  | a_expr LIKE a_expr
  | a_expr LIKE a_expr ESCAPE a_expr
  | a_expr NOT_LA LIKE a_expr
  | a_expr NOT_LA LIKE a_expr ESCAPE a_expr
  | a_expr ILIKE a_expr
  | a_expr ILIKE a_expr ESCAPE a_expr
  | a_expr NOT_LA ILIKE a_expr
  | a_expr NOT_LA ILIKE a_expr ESCAPE a_expr
  | a_expr SIMILAR TO a_expr
  | a_expr SIMILAR TO a_expr ESCAPE a_expr
  | a_expr NOT_LA SIMILAR TO a_expr
  | a_expr NOT_LA SIMILAR TO a_expr ESCAPE a_expr
  | a_expr IS NULL_P
  | a_expr ISNULL
  | a_expr IS NOT NULL_P
  | a_expr NOTNULL
  | row OVERLAPS row
  | a_expr IS TRUE_P
  | a_expr IS NOT TRUE_P
  | a_expr IS FALSE_P
  | a_expr IS NOT FALSE_P
  | a_expr IS UNKNOWN
  | a_expr IS NOT UNKNOWN
  | a_expr IS DISTINCT FROM a_expr
  | a_expr IS NOT DISTINCT FROM a_expr
  | a_expr IS OF '(' type_list ')'
  | a_expr IS NOT OF '(' type_list ')'
  | a_expr BETWEEN opt_asymmetric b_expr AND a_expr
  | a_expr NOT_LA BETWEEN opt_asymmetric b_expr AND a_expr
  | a_expr BETWEEN SYMMETRIC b_expr AND a_expr
  | a_expr NOT_LA BETWEEN SYMMETRIC b_expr AND a_expr
  | a_expr IN_P in_expr
  | a_expr NOT_LA IN_P in_expr
  | a_expr subquery_Op sub_type select_with_parens
  | a_expr subquery_Op sub_type '(' a_expr ')'
  | UNIQUE select_with_parens
  | a_expr IS DOCUMENT_P
  | a_expr IS NOT DOCUMENT_P
  | DEFAULT
Instances5Eq, Ord, Show, Generic, Rep
datadata BExpr
#
References
b_expr:
  | c_expr
  | b_expr TYPECAST Typename
  | + b_expr
  | - b_expr
  | b_expr + b_expr
  | b_expr - b_expr
  | b_expr * b_expr
  | b_expr / b_expr
  | b_expr % b_expr
  | b_expr ^ b_expr
  | b_expr < b_expr
  | b_expr > b_expr
  | b_expr = b_expr
  | b_expr LESS_EQUALS b_expr
  | b_expr GREATER_EQUALS b_expr
  | b_expr NOT_EQUALS b_expr
  | b_expr qual_Op b_expr
  | qual_Op b_expr
  | b_expr qual_Op
  | b_expr IS DISTINCT FROM b_expr
  | b_expr IS NOT DISTINCT FROM b_expr
  | b_expr IS OF '(' type_list ')'
  | b_expr IS NOT OF '(' type_list ')'
  | b_expr IS DOCUMENT_P
  | b_expr IS NOT DOCUMENT_P
Instances5Eq, Ord, Show, Generic, Rep
datadata CExpr
#
References
c_expr:
  | columnref
  | AexprConst
  | PARAM opt_indirection
  | '(' a_expr ')' opt_indirection
  | case_expr
  | func_expr
  | select_with_parens
  | select_with_parens indirection
  | EXISTS select_with_parens
  | ARRAY select_with_parens
  | ARRAY array_expr
  | explicit_row
  | implicit_row
  | GROUPING '(' expr_list ')'
Instances5Eq, Ord, Show, Generic, Rep
datadata InExpr
#
References
in_expr:
  | select_with_parens
  | '(' expr_list ')'
Instances5Eq, Ord, Show, Generic, Rep
datadata SubType
#
References
sub_type:
  | ANY
  | SOME
  | ALL
Instances7Bounded, Enum, Eq, Ord, Show, Generic, …
datadata ArrayExpr
#
References
array_expr:
  | '[' expr_list ']'
  | '[' array_expr_list ']'
  | '[' ']'
Instances5Eq, Ord, Show, Generic, Rep
datadata Row
#
References
row:
  | ROW '(' expr_list ')'
  | ROW '(' ')'
  | '(' expr_list ',' a_expr ')'
Instances5Eq, Ord, Show, Generic, Rep
datadata ImplicitRow
#
References
implicit_row:
  | '(' expr_list ',' a_expr ')'
Instances5Eq, Ord, Show, Generic, Rep
datadata FuncExpr
#
References
func_expr:
  | func_application within_group_clause filter_clause over_clause
  | func_expr_common_subexpr
Instances5Eq, Ord, Show, Generic, Rep
datadata FuncExprWindowless
#
References
func_expr_windowless:
  | func_application
  | func_expr_common_subexpr
Instances5Eq, Ord, Show, Generic, Rep
typetype FilterClause = AExpr
#
References
filter_clause:
  | FILTER '(' WHERE a_expr ')'
  | EMPTY
datadata OverClause
#
References
over_clause:
  | OVER window_specification
  | OVER ColId
  | EMPTY
Instances5Eq, Ord, Show, Generic, Rep
References
func_expr_common_subexpr:
  | COLLATION FOR '(' a_expr ')'
  | CURRENT_DATE
  | CURRENT_TIME
  | CURRENT_TIME '(' Iconst ')'
  | CURRENT_TIMESTAMP
  | CURRENT_TIMESTAMP '(' Iconst ')'
  | LOCALTIME
  | LOCALTIME '(' Iconst ')'
  | LOCALTIMESTAMP
  | LOCALTIMESTAMP '(' Iconst ')'
  | CURRENT_ROLE
  | CURRENT_USER
  | SESSION_USER
  | USER
  | CURRENT_CATALOG
  | CURRENT_SCHEMA
  | CAST '(' a_expr AS Typename ')'
  | EXTRACT '(' extract_list ')'
  | OVERLAY '(' overlay_list ')'
  | POSITION '(' position_list ')'
  | SUBSTRING '(' substr_list ')'
  | TREAT '(' a_expr AS Typename ')'
  | TRIM '(' BOTH trim_list ')'
  | TRIM '(' LEADING trim_list ')'
  | TRIM '(' TRAILING trim_list ')'
  | TRIM '(' trim_list ')'
  | NULLIF '(' a_expr ',' a_expr ')'
  | COALESCE '(' expr_list ')'
  | GREATEST '(' expr_list ')'
  | LEAST '(' expr_list ')'
  | XMLCONCAT '(' expr_list ')'
  | XMLELEMENT '(' NAME_P ColLabel ')'
  | XMLELEMENT '(' NAME_P ColLabel ',' xml_attributes ')'
  | XMLELEMENT '(' NAME_P ColLabel ',' expr_list ')'
  | XMLELEMENT '(' NAME_P ColLabel ',' xml_attributes ',' expr_list ')'
  | XMLEXISTS '(' c_expr xmlexists_argument ')'
  | XMLFOREST '(' xml_attribute_list ')'
  | XMLPARSE '(' document_or_content a_expr xml_whitespace_option ')'
  | XMLPI '(' NAME_P ColLabel ')'
  | XMLPI '(' NAME_P ColLabel ',' a_expr ')'
  | XMLROOT '(' a_expr ',' xml_root_version opt_xml_root_standalone ')'
  | XMLSERIALIZE '(' document_or_content a_expr AS SimpleTypename ')'

TODO: Implement the XML cases
Instances5Eq, Ord, Show, Generic, Rep
datadata ExtractList
#
References
extract_list:
  | extract_arg FROM a_expr
  | EMPTY
Instances5Eq, Ord, Show, Generic, Rep
datadata ExtractArg
#
References
extract_arg:
  | IDENT
  | YEAR_P
  | MONTH_P
  | DAY_P
  | HOUR_P
  | MINUTE_P
  | SECOND_P
  | Sconst
Instances5Eq, Ord, Show, Generic, Rep
datadata OverlayList
#
References
overlay_list:
  | a_expr overlay_placing substr_from substr_for
  | a_expr overlay_placing substr_from
Instances5Eq, Ord, Show, Generic, Rep
datadata PositionList
#
References
position_list:
  | b_expr IN_P b_expr
  | EMPTY
Instances5Eq, Ord, Show, Generic, Rep
datadata SubstrList
#
References
substr_list:
  | a_expr substr_from substr_for
  | a_expr substr_for substr_from
  | a_expr substr_from
  | a_expr substr_for
  | expr_list
  | EMPTY
Instances5Eq, Ord, Show, Generic, Rep
datadata SubstrListFromFor
#
References
  | a_expr substr_from substr_for
  | a_expr substr_for substr_from
  | a_expr substr_from
  | a_expr substr_for
Instances5Eq, Ord, Show, Generic, Rep
datadata TrimModifier
#
References
  | TRIM '(' BOTH trim_list ')'
  | TRIM '(' LEADING trim_list ')'
  | TRIM '(' TRAILING trim_list ')'
Instances7Bounded, Enum, Eq, Ord, Show, Generic, …
datadata TrimList
#
References
trim_list:
  | a_expr FROM expr_list
  | FROM expr_list
  | expr_list
Instances5Eq, Ord, Show, Generic, Rep
datadata CaseExpr
#
References
case_expr:
  | CASE case_arg when_clause_list case_default END_P
Instances5Eq, Ord, Show, Generic, Rep
typetype CaseArg = AExpr
#
References
case_arg:
  | a_expr
  | EMPTY
datadata WhenClause
#
References
when_clause:
  |  WHEN a_expr THEN a_expr

Constructors

Instances5Eq, Ord, Show, Generic, Rep
datadata FuncApplication
#
References
func_application:
  |  func_name '(' ')'
  |  func_name '(' func_arg_list opt_sort_clause ')'
  |  func_name '(' VARIADIC func_arg_expr opt_sort_clause ')'
  |  func_name '(' func_arg_list ',' VARIADIC func_arg_expr opt_sort_clause ')'
  |  func_name '(' ALL func_arg_list opt_sort_clause ')'
  |  func_name '(' DISTINCT func_arg_list opt_sort_clause ')'
  |  func_name '(' * ')'
Instances5Eq, Ord, Show, Generic, Rep
References
func_application:
  |  func_name '(' ')'
  |  func_name '(' func_arg_list opt_sort_clause ')'
  |  func_name '(' VARIADIC func_arg_expr opt_sort_clause ')'
  |  func_name '(' func_arg_list ',' VARIADIC func_arg_expr opt_sort_clause ')'
  |  func_name '(' ALL func_arg_list opt_sort_clause ')'
  |  func_name '(' DISTINCT func_arg_list opt_sort_clause ')'
  |  func_name '(' * ')'
Instances5Eq, Ord, Show, Generic, Rep
datadata FuncArgExpr
#
Instances5Eq, Ord, Show, Generic, Rep

Constants

18 declarations
datadata AexprConst
#

AexprConst: | Iconst | FCONST | Sconst | BCONST | XCONST | func_name Sconst | func_name '(' func_arg_list opt_sort_clause ')' Sconst | ConstTypename Sconst | ConstInterval Sconst opt_interval | ConstInterval '(' Iconst ')' Sconst | TRUE_P | FALSE_P | NULL_P

Instances5Eq, Ord, Show, Generic, Rep
datadata FuncConstArgs
#
References
  |  func_name '(' func_arg_list opt_sort_clause ')' Sconst
Instances5Eq, Ord, Show, Generic, Rep
datadata ConstTypename
#
References
ConstTypename:
  | Numeric
  | ConstBit
  | ConstCharacter
  | ConstDatetime
Instances5Eq, Ord, Show, Generic, Rep
datadata Numeric
#
References
Numeric:
  | INT_P
  | INTEGER
  | SMALLINT
  | BIGINT
  | REAL
  | FLOAT_P opt_float
  | DOUBLE_P PRECISION
  | DECIMAL_P opt_type_modifiers
  | DEC opt_type_modifiers
  | NUMERIC opt_type_modifiers
  | BOOLEAN_P
opt_float:
  | '(' Iconst ')'
  | EMPTY
opt_type_modifiers:
  | '(' expr_list ')'
  | EMPTY
Instances5Eq, Ord, Show, Generic, Rep
datadata Bit
#
References
Bit:
  | BitWithLength
  | BitWithoutLength
ConstBit:
  | BitWithLength
  | BitWithoutLength
BitWithLength:
  | BIT opt_varying '(' expr_list ')'
BitWithoutLength:
  | BIT opt_varying
Instances5Eq, Ord, Show, Generic, Rep
datadata ConstCharacter
#
References
Character:
  | CharacterWithLength
  | CharacterWithoutLength
ConstCharacter:
  | CharacterWithLength
  | CharacterWithoutLength
CharacterWithLength:
  | character '(' Iconst ')'
CharacterWithoutLength:
  | character
Instances5Eq, Ord, Show, Generic, Rep
datadata Character
#
References
character:
  | CHARACTER opt_varying
  | CHAR_P opt_varying
  | VARCHAR
  | NATIONAL CHARACTER opt_varying
  | NATIONAL CHAR_P opt_varying
  | NCHAR opt_varying
Instances5Eq, Ord, Show, Generic, Rep
datadata ConstDatetime
#
References
ConstDatetime:
  | TIMESTAMP '(' Iconst ')' opt_timezone
  | TIMESTAMP opt_timezone
  | TIME '(' Iconst ')' opt_timezone
  | TIME opt_timezone
Instances5Eq, Ord, Show, Generic, Rep
typetype Timezone = Bool
#
References
opt_timezone:
  | WITH_LA TIME ZONE
  | WITHOUT TIME ZONE
  | EMPTY
datadata Interval
#
References
opt_interval:
  | YEAR_P
  | MONTH_P
  | DAY_P
  | HOUR_P
  | MINUTE_P
  | interval_second
  | YEAR_P TO MONTH_P
  | DAY_P TO HOUR_P
  | DAY_P TO MINUTE_P
  | DAY_P TO interval_second
  | HOUR_P TO MINUTE_P
  | HOUR_P TO interval_second
  | MINUTE_P TO interval_second
  | EMPTY
Instances5Eq, Ord, Show, Generic, Rep

Names & References

13 declarations
datadata Ident
#
References
IDENT
Instances5Eq, Ord, Show, Generic, Rep
typetype ColId = Ident
#
References
ColId:
  | IDENT
  | unreserved_keyword
  | col_name_keyword
typetype ColLabel = Ident
#
References
ColLabel:
  | IDENT
  | unreserved_keyword
  | col_name_keyword
  | type_func_name_keyword
  | reserved_keyword
typetype Name = ColId
#
References
name:
  | ColId
datadata Columnref
#
References
columnref:
  | ColId
  | ColId indirection
Instances5Eq, Ord, Show, Generic, Rep
datadata AnyName
#
References
any_name:
  | ColId
  | ColId attrs

Constructors

Instances5Eq, Ord, Show, Generic, Rep
datadata FuncName
#
References
func_name:
  | type_function_name
  | ColId indirection
Instances5Eq, Ord, Show, Generic, Rep
typetype TypeFunctionName = Ident
#
References
type_function_name:
  | IDENT
  | unreserved_keyword
  | type_func_name_keyword
datadata QualifiedName
#
References
columnref:
  | ColId
  | ColId indirection
qualified_name:
  | ColId
  | ColId indirection
Instances5Eq, Ord, Show, Generic, Rep
datadata IndirectionEl
#
References
indirection_el:
  |  . attr_name
  |  . *
  |  '[' a_expr ']'
  |  '[' opt_slice_bound : opt_slice_bound ']'
opt_slice_bound:
  |  a_expr
  |  EMPTY
Instances5Eq, Ord, Show, Generic, Rep

Types

9 declarations
datadata Typename
#

Typename definition extended with custom question-marks for nullability specification.

To match the standard Postgres syntax simply interpret their presence as a parsing error.

References
Typename:
  | SimpleTypename opt_array_bounds
  | SETOF SimpleTypename opt_array_bounds
  | SimpleTypename ARRAY '[' Iconst ']'
  | SETOF SimpleTypename ARRAY '[' Iconst ']'
  | SimpleTypename ARRAY
  | SETOF SimpleTypename ARRAY
Instances5Eq, Ord, Show, Generic, Rep
References
Part of the Typename specification responsible for the choice between the following:
  | opt_array_bounds
  | ARRAY '[' Iconst ']'
  | ARRAY
Instances5Eq, Ord, Show, Generic, Rep
datadata SimpleTypename
#
References
SimpleTypename:
  | GenericType
  | Numeric
  | Bit
  | Character
  | ConstDatetime
  | ConstInterval opt_interval
  | ConstInterval '(' Iconst ')'
ConstInterval:
  | INTERVAL
Instances5Eq, Ord, Show, Generic, Rep
datadata GenericType
#
References
GenericType:
  | type_function_name opt_type_modifiers
  | type_function_name attrs opt_type_modifiers
Instances5Eq, Ord, Show, Generic, Rep

Operators

11 declarations
datadata QualOp
#
References
qual_Op:
  | Op
  | OPERATOR '(' any_operator ')'
Instances5Eq, Ord, Show, Generic, Rep
datadata QualAllOp
#
References
qual_all_Op:
  | all_Op
  | OPERATOR '(' any_operator ')'
Instances5Eq, Ord, Show, Generic, Rep
typetype Op = Text
#
References
The operator name is a sequence of up to NAMEDATALEN-1 (63 by default)
characters from the following list:

+ - * /  = ~ !  # % ^ & | ` ?

There are a few restrictions on your choice of name:
-- and /* cannot appear anywhere in an operator name,
since they will be taken as the start of a comment.

A multicharacter operator name cannot end in + or -,
unless the name also contains at least one of these characters:

~ !  # % ^ & | ` ?

For example, @- is an allowed operator name, but *- is not.
This restriction allows PostgreSQL to parse SQL-compliant
commands without requiring spaces between tokens.
The use of => as an operator name is deprecated.
It may be disallowed altogether in a future release.

The operator != is mapped to <> on input,
so these two names are always equivalent.
datadata AnyOperator
#
References
any_operator:
  | all_Op
  | ColId . any_operator
Instances5Eq, Ord, Show, Generic, Rep
datadata AllOp
#
References
all_Op:
  | Op
  | MathOp
Instances5Eq, Ord, Show, Generic, Rep
datadata MathOp
#
Instances7Bounded, Enum, Eq, Ord, Show, Generic, …
datadata SymbolicExprBinOp
#
Instances5Eq, Ord, Show, Generic, Rep
datadata VerbalExprBinOp
#
Instances7Bounded, Enum, Eq, Ord, Show, Generic, …
datadata AExprReversableOp
#
References
  | a_expr IS NULL_P
  | a_expr IS TRUE_P
  | a_expr IS FALSE_P
  | a_expr IS UNKNOWN
  | a_expr IS DISTINCT FROM a_expr
  | a_expr IS OF '(' type_list ')'
  | a_expr BETWEEN opt_asymmetric b_expr AND a_expr
  | a_expr BETWEEN SYMMETRIC b_expr AND a_expr
  | a_expr IN_P in_expr
  | a_expr IS DOCUMENT_P
Instances5Eq, Ord, Show, Generic, Rep
datadata BExprIsOp
#
References
  | b_expr IS DISTINCT FROM b_expr
  | b_expr IS NOT DISTINCT FROM b_expr
  | b_expr IS OF '(' type_list ')'
  | b_expr IS NOT OF '(' type_list ')'
  | b_expr IS DOCUMENT_P
  | b_expr IS NOT DOCUMENT_P
Instances5Eq, Ord, Show, Generic, Rep
datadata SubqueryOp
#
References
subquery_Op:
  | all_Op
  | OPERATOR '(' any_operator ')'
  | LIKE
  | NOT_LA LIKE
  | ILIKE
  | NOT_LA ILIKE
Instances5Eq, Ord, Show, Generic, Rep

Indexes

7 declarations
datadata IndexElem
#
References
index_elem:
  | ColId opt_collate opt_class opt_asc_desc opt_nulls_order
  | func_expr_windowless opt_collate opt_class opt_asc_desc opt_nulls_order
  | '(' a_expr ')' opt_collate opt_class opt_asc_desc opt_nulls_order
Instances5Eq, Ord, Show, Generic, Rep
datadata IndexElemDef
#
References
  | ColId opt_collate opt_class opt_asc_desc opt_nulls_order
  | func_expr_windowless opt_collate opt_class opt_asc_desc opt_nulls_order
  | '(' a_expr ')' opt_collate opt_class opt_asc_desc opt_nulls_order
Instances5Eq, Ord, Show, Generic, Rep
typetype Collate = AnyName
#
References
opt_collate:
  | COLLATE any_name
  | EMPTY
typetype Class = AnyName
#
References
opt_class:
  | any_name
  | EMPTY
datadata AscDesc
#
References
opt_asc_desc:
  | ASC
  | DESC
  | EMPTY
Instances7Bounded, Enum, Eq, Ord, Show, Generic, …
datadata NullsOrder
#
References
opt_nulls_order:
  | NULLS_LA FIRST_P
  | NULLS_LA LAST_P
  | EMPTY
Instances7Bounded, Enum, Eq, Ord, Show, Generic, …