@@ -827,24 +827,24 @@ dropNotNull = UnsafeAlterColumn $ "DROP NOT NULL"
827827alterType :: ColumnTypeExpression db ty -> AlterColumn db ty0 ty
828828alterType ty = UnsafeAlterColumn $ "TYPE" <+> renderColumnTypeExpression ty
829829
830−-- | Create a view.
831−--
832−-- >>> :{
833−-- let
834−-- definition :: Definition
835−-- '[ "public" ::: '["abc" ::: 'Table ('[] :=> '["a" ::: 'NoDef :=> 'Null 'PGint4, "b" ::: 'NoDef :=> 'Null 'PGint4, "c" ::: 'NoDef :=> 'Null 'PGint4])]]
836−-- '[ "public" ::: '["abc" ::: 'Table ('[] :=> '["a" ::: 'NoDef :=> 'Null 'PGint4, "b" ::: 'NoDef :=> 'Null 'PGint4, "c" ::: 'NoDef :=> 'Null 'PGint4])
837−-- , "bc" ::: 'View ('["b" ::: 'Null 'PGint4, "c" ::: 'Null 'PGint4])]]
838−-- definition =
839−-- createView #bc (select (#b :* #c) (from (table #abc)))
840−-- in printSQL definition
841−-- :}
842−-- CREATE VIEW "bc" AS SELECT "b" AS "b", "c" AS "c" FROM "abc" AS "abc";
830+{- | Create a view.
831+>>> type ABC = '["a" ::: 'NoDef :=> 'Null 'PGint4, "b" ::: 'NoDef :=> 'Null 'PGint4, "c" ::: 'NoDef :=> 'Null 'PGint4]
832+>>> type BC = '["b" ::: 'Null 'PGint4, "c" ::: 'Null 'PGint4]
833+>>> :{
834+let
835+ definition :: Definition
836+ '[ "public" ::: '["abc" ::: 'Table ('[] :=> ABC)]]
837+ '[ "public" ::: '["abc" ::: 'Table ('[] :=> ABC), "bc" ::: 'View BC]]
838+ definition =
839+ createView #bc (select (#b :* #c) (from (table #abc)))
840+in printSQL definition
841+:}
842+CREATE VIEW "bc" AS SELECT "b" AS "b", "c" AS "c" FROM "abc" AS "abc";
843+-}
843844createView
844845 :: (KnownSymbol sch, KnownSymbol vw, Has sch db schema)
845846 => QualifiedAlias sch vw -- ^ the name of the view to add
846− -> Query db '[] view
847− -- ^ query
847+ -> Query db '[] view -- ^ query
848848 -> Definition db (Alter sch (Create vw ('View view) schema) db)
849849createView alias query = UnsafeDefinition $
850850 "CREATE" <+> "VIEW" <+> renderQualifiedAlias alias <+> "AS"