@@ -188,22 +188,18 @@ project
188188 -> Projection ps xs ys
189189project = UnsafeProjection . renderAllAliased renderExpression
190190
191−data Tabulation ps xss xs = UnsafeTabulation
192− { renderTabulation :: ByteString }
193−
194−data Relation ps xss xs = Relation
195− { tabulation :: Tabulation ps xss xs
191+data Relation ps xss xs = UnsafeRelation
192+ { relation :: ByteString
196193 , restriction :: Maybe (Expression ps xs 'PGBool)
197194 , limitation :: Maybe (Expression ps '[] 'PGInt8)
198195 , offsetting :: Maybe (Expression ps '[] 'PGInt8)
199196 }
200197
201198renderRelation :: Relation ps xss xs -> ByteString
202−renderRelation (Relation tab wh lim off) =
203− renderTabulation tab
204− <> maybe "" ((" WHERE " <>) . renderExpression) wh
205− <> maybe "" ((" LIMIT " <>) . renderExpression) lim
206− <> maybe "" ((" OFFSET " <>) . renderExpression) off
199+renderRelation (UnsafeRelation rel wh lim off) = rel
200+ <> maybe "" ((" WHERE " <>) . renderExpression) wh
201+ <> maybe "" ((" LIMIT " <>) . renderExpression) lim
202+ <> maybe "" ((" OFFSET " <>) . renderExpression) off
207203
208204where_
209205 :: Relation ps xss xs
@@ -237,9 +233,8 @@ ys `offset` n = ys
237233
238234instance HasField label xss xs
239235 => IsLabel label (Relation ps xss xs) where
240− fromLabel _ = Relation
241− { tabulation = UnsafeTabulation $
242− fieldName (Proxy @label) (Proxy @xss) (Proxy @xs)
236+ fromLabel _ = UnsafeRelation
237+ { relation = fieldName (Proxy @label) (Proxy @xss) (Proxy @xs)
243238 , restriction = Nothing
244239 , limitation = Nothing
245240 , offsetting = Nothing
@@ -253,8 +248,8 @@ ys `from` xs = UnsafeSelection $
253248 renderProjection ys <> " FROM " <> renderRelation xs
254249
255250subselect :: Selection ps xss ys -> Relation ps xss ys
256−subselect selection = Relation
257− { tabulation = UnsafeTabulation $ "SELECT " <> renderSelection selection
251+subselect selection = UnsafeRelation
252+ { relation = "SELECT " <> renderSelection selection
258253 , restriction = Nothing
259254 , limitation = Nothing
260255 , offsetting = Nothing