squeal-postgresql-0.9.0.0: Squeal PostgreSQL Library
Copyright(c) Eitan Chatav 2019
Maintainereitan@morphism.tech
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Squeal.PostgreSQL.Query.Select

Contents

Description

select statements

Synopsis

Select

select Source #

Arguments

:: (SListI row, row ~ (x ': xs)) 
=> Selection grp lat with db params from row

selection

-> TableExpression grp lat with db params from

intermediate virtual table

-> Query lat with db params row 

the TableExpression in the select command constructs an intermediate virtual table by possibly combining tables, views, eliminating rows, grouping, etc. This table is finally passed on to processing by the select list. The Selection determines which columns of the intermediate table are actually output.

select_ Source #

Arguments

:: (SListI row, row ~ (x ': xs)) 
=> NP (Aliased (Expression grp lat with db params from)) row

select list

-> TableExpression grp lat with db params from

intermediate virtual table

-> Query lat with db params row 

Like select but takes an NP list of Expressions instead of a general Selection.

selectDistinct Source #

Arguments

:: (SListI columns, columns ~ (col ': cols)) 
=> Selection grp lat with db params from columns

selection

-> TableExpression grp lat with db params from

intermediate virtual table

-> Query lat with db params columns 

After the select list has been processed, the result table can be subject to the elimination of duplicate rows using selectDistinct.

selectDistinct_ Source #

Arguments

:: (SListI columns, columns ~ (col ': cols)) 
=> NP (Aliased (Expression grp lat with db params from)) columns

select list

-> TableExpression grp lat with db params from

intermediate virtual table

-> Query lat with db params columns 

Like selectDistinct but takes an NP list of Expressions instead of a general Selection.

selectDistinctOn Source #

Arguments

:: (SListI columns, columns ~ (col ': cols)) 
=> [SortExpression grp lat with db params from]

DISTINCT ON expression(s) and prepended to ORDER BY clause

-> Selection grp lat with db params from columns

selection

-> TableExpression grp lat with db params from

intermediate virtual table

-> Query lat with db params columns 

selectDistinctOn keeps only the first row of each set of rows where the given expressions evaluate to equal. The DISTINCT ON expressions are interpreted using the same rules as for ORDER BY. ORDER BY is used to ensure that the desired row appears first.

The DISTINCT ON expression(s) must match the leftmost ORDER BY expression(s). The ORDER BY clause will normally contain additional expression(s) that determine the desired precedence of rows within each DISTINCT ON group.

In order to guarantee they match and reduce redundancy, this function will prepend the The DISTINCT ON expressions to the ORDER BY clause.

selectDistinctOn_ Source #

Arguments

:: (SListI columns, columns ~ (col ': cols)) 
=> [SortExpression grp lat with db params from]

distinct on and return the first row in ordering

-> NP (Aliased (Expression grp lat with db params from)) columns

selection

-> TableExpression grp lat with db params from

intermediate virtual table

-> Query lat with db params columns 

Like selectDistinctOn but takes an NP list of Expressions instead of a general Selection.

data Selection grp lat with db params from row where Source #

The simplest kinds of Selection are Star and DotStar which emits all columns that a TableExpression produces. A select List is a list of Expressions. A Selection could be a list of WindowFunctions Over WindowDefinition. Additional Selections can be selected with Also.

Constructors

Star 

Fields

DotStar 

Fields

List 

Fields

Over 

Fields

Also 

Fields

Instances

Instances details
(Has tab (Join from lat) row0, Has col row0 ty, row1 ~ '[col ::: ty], GroupedBy tab col bys) => IsQualified tab col (Selection ('Grouped bys) lat with db params from row1) Source # 
Instance details

Defined in Squeal.PostgreSQL.Query.Select

Methods

(!) :: Alias tab -> Alias col -> Selection ('Grouped bys) lat with db params from row1 Source #

(Has tab (Join from lat) row0, Has col row0 ty, row1 ~ '[col ::: ty]) => IsQualified tab col (Selection 'Ungrouped lat with db params from row1) Source # 
Instance details

Defined in Squeal.PostgreSQL.Query.Select

Methods

(!) :: Alias tab -> Alias col -> Selection 'Ungrouped lat with db params from row1 Source #

(HasUnique tab (Join from lat) row0, Has col row0 ty, row1 ~ '[col ::: ty], GroupedBy tab col bys) => IsLabel col (Selection ('Grouped bys) lat with db params from row1) Source # 
Instance details

Defined in Squeal.PostgreSQL.Query.Select

Methods

fromLabel :: Selection ('Grouped bys) lat with db params from row1 #

(HasUnique tab (Join from lat) row0, Has col row0 ty, row1 ~ '[col ::: ty]) => IsLabel col (Selection 'Ungrouped lat with db params from row1) Source # 
Instance details

Defined in Squeal.PostgreSQL.Query.Select

Methods

fromLabel :: Selection 'Ungrouped lat with db params from row1 #

(KnownSymbol col, row ~ '[col ::: ty]) => Aliasable col (Expression grp lat with db params from ty) (Selection grp lat with db params from row) Source # 
Instance details

Defined in Squeal.PostgreSQL.Query.Select

Methods

as :: Expression grp lat with db params from ty -> Alias col -> Selection grp lat with db params from row Source #

Additional (Selection grp lat with db params from :: RowType -> Type) Source # 
Instance details

Defined in Squeal.PostgreSQL.Query.Select

Methods

also :: forall (ys :: [a]) (xs :: [a]). Selection grp lat with db params from ys -> Selection grp lat with db params from xs -> Selection grp lat with db params from (Join xs ys) Source #

IsString (Selection grp lat with db params from '["fromOnly" ::: 'NotNull 'PGtext]) Source # 
Instance details

Defined in Squeal.PostgreSQL.Query.Select

Methods

fromString :: String -> Selection grp lat with db params from '["fromOnly" ::: 'NotNull 'PGtext] #

RenderSQL (Selection grp lat with db params from row) Source # 
Instance details

Defined in Squeal.PostgreSQL.Query.Select

Methods

renderSQL :: Selection grp lat with db params from row -> ByteString Source #