|  | 
Select{ann = A, selDistinct = All,
       selSelectList = SelectList (A) [SelExp (A) (NumberLit (A) "1")],
       selTref = [], selWhere = Nothing, selGroupBy = [],
       selHaving = Nothing, selOrderBy = [], selLimit = Nothing,
       selOffset = Nothing, selOption = []}
 | 
|  | 
Select{ann = A, selDistinct = All,
       selSelectList =
         SelectList (A) [SelExp (A) (Identifier (A) (Name (A) [Nmc "a"]))],
       selTref = [Tref (A) (Name (A) [Nmc "t"])], selWhere = Nothing,
       selGroupBy = [], selHaving = Nothing, selOrderBy = [],
       selLimit = Nothing, selOffset = Nothing, selOption = []}
 | 
| 
select distinct a from t;
 | 
Select{ann = A, selDistinct = Distinct,
       selSelectList =
         SelectList (A) [SelExp (A) (Identifier (A) (Name (A) [Nmc "a"]))],
       selTref = [Tref (A) (Name (A) [Nmc "t"])], selWhere = Nothing,
       selGroupBy = [], selHaving = Nothing, selOrderBy = [],
       selLimit = Nothing, selOffset = Nothing, selOption = []}
 | 
| 
select a from t where b=2;
 | 
Select{ann = A, selDistinct = All,
       selSelectList =
         SelectList (A) [SelExp (A) (Identifier (A) (Name (A) [Nmc "a"]))],
       selTref = [Tref (A) (Name (A) [Nmc "t"])],
       selWhere =
         Just
           (BinaryOp (A) (Name (A) [Nmc "="])
              (Identifier (A) (Name (A) [Nmc "b"]))
              (NumberLit (A) "2")),
       selGroupBy = [], selHaving = Nothing, selOrderBy = [],
       selLimit = Nothing, selOffset = Nothing, selOption = []}
 | 
| 
select a from t where b=2 and c=3;
 | 
Select{ann = A, selDistinct = All,
       selSelectList =
         SelectList (A) [SelExp (A) (Identifier (A) (Name (A) [Nmc "a"]))],
       selTref = [Tref (A) (Name (A) [Nmc "t"])],
       selWhere =
         Just
           (BinaryOp (A) (Name (A) [Nmc "and"])
              (BinaryOp (A) (Name (A) [Nmc "="])
                 (Identifier (A) (Name (A) [Nmc "b"]))
                 (NumberLit (A) "2"))
              (BinaryOp (A) (Name (A) [Nmc "="])
                 (Identifier (A) (Name (A) [Nmc "c"]))
                 (NumberLit (A) "3"))),
       selGroupBy = [], selHaving = Nothing, selOrderBy = [],
       selLimit = Nothing, selOffset = Nothing, selOption = []}
 | 
| 
SELECT T.A::INT FROM TBL AS T;
 | 
Select{ann = A, selDistinct = All,
       selSelectList =
         SelectList (A)
           [SelExp (A)
              (Cast (A) (Identifier (A) (Name (A) [Nmc "T", Nmc "A"]))
                 (SimpleTypeName (A) (Name (A) [Nmc "INT"])))],
       selTref =
         [TableAlias (A) (Nmc "T") (Tref (A) (Name (A) [Nmc "TBL"]))],
       selWhere = Nothing, selGroupBy = [], selHaving = Nothing,
       selOrderBy = [], selLimit = Nothing, selOffset = Nothing,
       selOption = []}
 | 
| 
select a from t order by a;
 | 
Select{ann = A, selDistinct = All,
       selSelectList =
         SelectList (A) [SelExp (A) (Identifier (A) (Name (A) [Nmc "a"]))],
       selTref = [Tref (A) (Name (A) [Nmc "t"])], selWhere = Nothing,
       selGroupBy = [], selHaving = Nothing,
       selOrderBy =
         [(Identifier (A) (Name (A) [Nmc "a"]), Asc, NullsDefault)],
       selLimit = Nothing, selOffset = Nothing, selOption = []}
 | 
| 
select a from t order by a asc;
 | 
Select{ann = A, selDistinct = All,
       selSelectList =
         SelectList (A) [SelExp (A) (Identifier (A) (Name (A) [Nmc "a"]))],
       selTref = [Tref (A) (Name (A) [Nmc "t"])], selWhere = Nothing,
       selGroupBy = [], selHaving = Nothing,
       selOrderBy =
         [(Identifier (A) (Name (A) [Nmc "a"]), Asc, NullsDefault)],
       selLimit = Nothing, selOffset = Nothing, selOption = []}
 | 
| 
select a from t order by a desc;
 | 
Select{ann = A, selDistinct = All,
       selSelectList =
         SelectList (A) [SelExp (A) (Identifier (A) (Name (A) [Nmc "a"]))],
       selTref = [Tref (A) (Name (A) [Nmc "t"])], selWhere = Nothing,
       selGroupBy = [], selHaving = Nothing,
       selOrderBy =
         [(Identifier (A) (Name (A) [Nmc "a"]), Desc, NullsDefault)],
       selLimit = Nothing, selOffset = Nothing, selOption = []}
 | 
| 
select a from t order by a,b;
 | 
Select{ann = A, selDistinct = All,
       selSelectList =
         SelectList (A) [SelExp (A) (Identifier (A) (Name (A) [Nmc "a"]))],
       selTref = [Tref (A) (Name (A) [Nmc "t"])], selWhere = Nothing,
       selGroupBy = [], selHaving = Nothing,
       selOrderBy =
         [(Identifier (A) (Name (A) [Nmc "a"]), Asc, NullsDefault),
          (Identifier (A) (Name (A) [Nmc "b"]), Asc, NullsDefault)],
       selLimit = Nothing, selOffset = Nothing, selOption = []}
 | 
| 
select a from t order by a asc,b;
 | 
Select{ann = A, selDistinct = All,
       selSelectList =
         SelectList (A) [SelExp (A) (Identifier (A) (Name (A) [Nmc "a"]))],
       selTref = [Tref (A) (Name (A) [Nmc "t"])], selWhere = Nothing,
       selGroupBy = [], selHaving = Nothing,
       selOrderBy =
         [(Identifier (A) (Name (A) [Nmc "a"]), Asc, NullsDefault),
          (Identifier (A) (Name (A) [Nmc "b"]), Asc, NullsDefault)],
       selLimit = Nothing, selOffset = Nothing, selOption = []}
 | 
| 
select a from t order by a desc,b;
 | 
Select{ann = A, selDistinct = All,
       selSelectList =
         SelectList (A) [SelExp (A) (Identifier (A) (Name (A) [Nmc "a"]))],
       selTref = [Tref (A) (Name (A) [Nmc "t"])], selWhere = Nothing,
       selGroupBy = [], selHaving = Nothing,
       selOrderBy =
         [(Identifier (A) (Name (A) [Nmc "a"]), Desc, NullsDefault),
          (Identifier (A) (Name (A) [Nmc "b"]), Asc, NullsDefault)],
       selLimit = Nothing, selOffset = Nothing, selOption = []}
 | 
| 
select a from t order by a desc,b desc;
 | 
Select{ann = A, selDistinct = All,
       selSelectList =
         SelectList (A) [SelExp (A) (Identifier (A) (Name (A) [Nmc "a"]))],
       selTref = [Tref (A) (Name (A) [Nmc "t"])], selWhere = Nothing,
       selGroupBy = [], selHaving = Nothing,
       selOrderBy =
         [(Identifier (A) (Name (A) [Nmc "a"]), Desc, NullsDefault),
          (Identifier (A) (Name (A) [Nmc "b"]), Desc, NullsDefault)],
       selLimit = Nothing, selOffset = Nothing, selOption = []}
 | 
| 
select a from t order by a nulls first;
 | 
Select{ann = A, selDistinct = All,
       selSelectList =
         SelectList (A) [SelExp (A) (Identifier (A) (Name (A) [Nmc "a"]))],
       selTref = [Tref (A) (Name (A) [Nmc "t"])], selWhere = Nothing,
       selGroupBy = [], selHaving = Nothing,
       selOrderBy =
         [(Identifier (A) (Name (A) [Nmc "a"]), Asc, NullsFirst)],
       selLimit = Nothing, selOffset = Nothing, selOption = []}
 | 
| 
select a from t order by a nulls last;
 | 
Select{ann = A, selDistinct = All,
       selSelectList =
         SelectList (A) [SelExp (A) (Identifier (A) (Name (A) [Nmc "a"]))],
       selTref = [Tref (A) (Name (A) [Nmc "t"])], selWhere = Nothing,
       selGroupBy = [], selHaving = Nothing,
       selOrderBy =
         [(Identifier (A) (Name (A) [Nmc "a"]), Asc, NullsLast)],
       selLimit = Nothing, selOffset = Nothing, selOption = []}
 | 
| 
select a from t order by a asc nulls first;
 | 
Select{ann = A, selDistinct = All,
       selSelectList =
         SelectList (A) [SelExp (A) (Identifier (A) (Name (A) [Nmc "a"]))],
       selTref = [Tref (A) (Name (A) [Nmc "t"])], selWhere = Nothing,
       selGroupBy = [], selHaving = Nothing,
       selOrderBy =
         [(Identifier (A) (Name (A) [Nmc "a"]), Asc, NullsFirst)],
       selLimit = Nothing, selOffset = Nothing, selOption = []}
 | 
| 
select a from t order by a asc nulls last;
 | 
Select{ann = A, selDistinct = All,
       selSelectList =
         SelectList (A) [SelExp (A) (Identifier (A) (Name (A) [Nmc "a"]))],
       selTref = [Tref (A) (Name (A) [Nmc "t"])], selWhere = Nothing,
       selGroupBy = [], selHaving = Nothing,
       selOrderBy =
         [(Identifier (A) (Name (A) [Nmc "a"]), Asc, NullsLast)],
       selLimit = Nothing, selOffset = Nothing, selOption = []}
 | 
| 
select a from t order by a desc nulls first;
 | 
Select{ann = A, selDistinct = All,
       selSelectList =
         SelectList (A) [SelExp (A) (Identifier (A) (Name (A) [Nmc "a"]))],
       selTref = [Tref (A) (Name (A) [Nmc "t"])], selWhere = Nothing,
       selGroupBy = [], selHaving = Nothing,
       selOrderBy =
         [(Identifier (A) (Name (A) [Nmc "a"]), Desc, NullsFirst)],
       selLimit = Nothing, selOffset = Nothing, selOption = []}
 | 
| 
select a from t order by a desc nulls last;
 | 
Select{ann = A, selDistinct = All,
       selSelectList =
         SelectList (A) [SelExp (A) (Identifier (A) (Name (A) [Nmc "a"]))],
       selTref = [Tref (A) (Name (A) [Nmc "t"])], selWhere = Nothing,
       selGroupBy = [], selHaving = Nothing,
       selOrderBy =
         [(Identifier (A) (Name (A) [Nmc "a"]), Desc, NullsLast)],
       selLimit = Nothing, selOffset = Nothing, selOption = []}
 | 
|  | 
Select{ann = A, selDistinct = All,
       selSelectList =
         SelectList (A) [SelExp (A) (Identifier (A) (Name (A) [Nmc "a"]))],
       selTref = [Tref (A) (Name (A) [Nmc "t"])], selWhere = Nothing,
       selGroupBy = [], selHaving = Nothing, selOrderBy = [],
       selLimit = Just (NumberLit (A) "1"), selOffset = Nothing,
       selOption = []}
 | 
| 
select a from t offset 1;
 | 
Select{ann = A, selDistinct = All,
       selSelectList =
         SelectList (A) [SelExp (A) (Identifier (A) (Name (A) [Nmc "a"]))],
       selTref = [Tref (A) (Name (A) [Nmc "t"])], selWhere = Nothing,
       selGroupBy = [], selHaving = Nothing, selOrderBy = [],
       selLimit = Nothing, selOffset = Just (NumberLit (A) "1"),
       selOption = []}
 | 
| 
select a from t order by a limit 1 offset 1;
 | 
Select{ann = A, selDistinct = All,
       selSelectList =
         SelectList (A) [SelExp (A) (Identifier (A) (Name (A) [Nmc "a"]))],
       selTref = [Tref (A) (Name (A) [Nmc "t"])], selWhere = Nothing,
       selGroupBy = [], selHaving = Nothing,
       selOrderBy =
         [(Identifier (A) (Name (A) [Nmc "a"]), Asc, NullsDefault)],
       selLimit = Just (NumberLit (A) "1"),
       selOffset = Just (NumberLit (A) "1"), selOption = []}
 | 
| 
select (p).x, (p).y from pos;
 | 
Select{ann = A, selDistinct = All,
       selSelectList =
         SelectList (A)
           [SelExp (A)
              (BinaryOp (A) (Name (A) [Nmc "."])
                 (Parens (A) (Identifier (A) (Name (A) [Nmc "p"])))
                 (Identifier (A) (Name (A) [Nmc "x"]))),
            SelExp (A)
              (BinaryOp (A) (Name (A) [Nmc "."])
                 (Parens (A) (Identifier (A) (Name (A) [Nmc "p"])))
                 (Identifier (A) (Name (A) [Nmc "y"])))],
       selTref = [Tref (A) (Name (A) [Nmc "pos"])], selWhere = Nothing,
       selGroupBy = [], selHaving = Nothing, selOrderBy = [],
       selLimit = Nothing, selOffset = Nothing, selOption = []}
 | 
| 
select ($1).x, ($1).y from pos;
 | 
Select{ann = A, selDistinct = All,
       selSelectList =
         SelectList (A)
           [SelExp (A)
              (BinaryOp (A) (Name (A) [Nmc "."])
                 (Parens (A) (PositionalArg (A) 1))
                 (Identifier (A) (Name (A) [Nmc "x"]))),
            SelExp (A)
              (BinaryOp (A) (Name (A) [Nmc "."])
                 (Parens (A) (PositionalArg (A) 1))
                 (Identifier (A) (Name (A) [Nmc "y"])))],
       selTref = [Tref (A) (Name (A) [Nmc "pos"])], selWhere = Nothing,
       selGroupBy = [], selHaving = Nothing, selOrderBy = [],
       selLimit = Nothing, selOffset = Nothing, selOption = []}
 | 
| 
select right ('test string',5) from t;
 | 
Select{ann = A, selDistinct = All,
       selSelectList =
         SelectList (A)
           [SelExp (A)
              (App (A) (Name (A) [Nmc "right"])
                 [StringLit (A) "test string", NumberLit (A) "5"])],
       selTref = [Tref (A) (Name (A) [Nmc "t"])], selWhere = Nothing,
       selGroupBy = [], selHaving = Nothing, selOrderBy = [],
       selLimit = Nothing, selOffset = Nothing, selOption = []}
 |