on dev help sign in
fix some more test errors
186ba63Eitan Chatav
squeal-postgresql/src/Squeal/PostgreSQL/Definition.hs+49−36
@@ -590,8 +590,8 @@ newtype AlterTable
590-- >>> :{
590-- >>> :{
591-- let
591-- let
592-- definition :: Definition
592-- definition :: Definition
593−-- '["tab" ::: 'Table ('[] :=> '["col" ::: 'NoDef :=> 'NotNull 'PGint4])]
593+-- '["public" ::: '["tab" ::: 'Table ('[] :=> '["col" ::: 'NoDef :=> 'NotNull 'PGint4])]]
594−-- '["tab" ::: 'Table ('["positive" ::: Check '["col"]] :=> '["col" ::: 'NoDef :=> 'NotNull 'PGint4])]
594+-- '["public" ::: '["tab" ::: 'Table ('["positive" ::: Check '["col"]] :=> '["col" ::: 'NoDef :=> 'NotNull 'PGint4])]]
595-- definition = alterTable #tab (addConstraint #positive (check #col (#col .> 0)))
595-- definition = alterTable #tab (addConstraint #positive (check #col (#col .> 0)))
596-- in printSQL definition
596-- in printSQL definition
597-- :}
597-- :}
@@ -615,8 +615,8 @@ addConstraint alias constraint = UnsafeAlterTable $
615-- >>> :{
615-- >>> :{
616-- let
616-- let
617-- definition :: Definition
617-- definition :: Definition
618−-- '["tab" ::: 'Table ('["positive" ::: Check '["col"]] :=> '["col" ::: 'NoDef :=> 'NotNull 'PGint4])]
618+-- '["public" ::: '["tab" ::: 'Table ('["positive" ::: Check '["col"]] :=> '["col" ::: 'NoDef :=> 'NotNull 'PGint4])]]
619−-- '["tab" ::: 'Table ('[] :=> '["col" ::: 'NoDef :=> 'NotNull 'PGint4])]
619+-- '["public" ::: '["tab" ::: 'Table ('[] :=> '["col" ::: 'NoDef :=> 'NotNull 'PGint4])]]
620-- definition = alterTable #tab (dropConstraint #positive)
620-- definition = alterTable #tab (dropConstraint #positive)
621-- in printSQL definition
621-- in printSQL definition
622-- :}
622-- :}
@@ -641,10 +641,10 @@ class AddColumn ty where
641 -- >>> :{
641 -- >>> :{
642 -- let
642 -- let
643 -- definition :: Definition
643 -- definition :: Definition
644− -- '["tab" ::: 'Table ('[] :=> '["col1" ::: 'NoDef :=> 'Null 'PGint4])]
644+ -- '["public" ::: '["tab" ::: 'Table ('[] :=> '["col1" ::: 'NoDef :=> 'Null 'PGint4])]]
645− -- '["tab" ::: 'Table ('[] :=>
645+ -- '["public" ::: '["tab" ::: 'Table ('[] :=>
646 -- '[ "col1" ::: 'NoDef :=> 'Null 'PGint4
646 -- '[ "col1" ::: 'NoDef :=> 'Null 'PGint4
647− -- , "col2" ::: 'Def :=> 'Null 'PGtext ])]
647+ -- , "col2" ::: 'Def :=> 'Null 'PGtext ])]]
648 -- definition = alterTable #tab (addColumn #col2 (text & nullable & default_ "foo"))
648 -- definition = alterTable #tab (addColumn #col2 (text & nullable & default_ "foo"))
649 -- in printSQL definition
649 -- in printSQL definition
650 -- :}
650 -- :}
@@ -653,10 +653,10 @@ class AddColumn ty where
653 -- >>> :{
653 -- >>> :{
654 -- let
654 -- let
655 -- definition :: Definition
655 -- definition :: Definition
656− -- '["tab" ::: 'Table ('[] :=> '["col1" ::: 'NoDef :=> 'Null 'PGint4])]
656+ -- '["public" ::: '["tab" ::: 'Table ('[] :=> '["col1" ::: 'NoDef :=> 'Null 'PGint4])]]
657− -- '["tab" ::: 'Table ('[] :=>
657+ -- '["public" ::: '["tab" ::: 'Table ('[] :=>
658 -- '[ "col1" ::: 'NoDef :=> 'Null 'PGint4
658 -- '[ "col1" ::: 'NoDef :=> 'Null 'PGint4
659− -- , "col2" ::: 'NoDef :=> 'Null 'PGtext ])]
659+ -- , "col2" ::: 'NoDef :=> 'Null 'PGtext ])]]
660 -- definition = alterTable #tab (addColumn #col2 (text & nullable))
660 -- definition = alterTable #tab (addColumn #col2 (text & nullable))
661 -- in printSQL definition
661 -- in printSQL definition
662 -- :}
662 -- :}
@@ -682,10 +682,10 @@ instance {-# OVERLAPPABLE #-} AddColumn ('NoDef :=> 'Null ty)
682-- >>> :{
682-- >>> :{
683-- let
683-- let
684-- definition :: Definition
684-- definition :: Definition
685−-- '["tab" ::: 'Table ('[] :=>
685+-- '["public" ::: '["tab" ::: 'Table ('[] :=>
686-- '[ "col1" ::: 'NoDef :=> 'Null 'PGint4
686-- '[ "col1" ::: 'NoDef :=> 'Null 'PGint4
687−-- , "col2" ::: 'NoDef :=> 'Null 'PGtext ])]
687+-- , "col2" ::: 'NoDef :=> 'Null 'PGtext ])]]
688−-- '["tab" ::: 'Table ('[] :=> '["col1" ::: 'NoDef :=> 'Null 'PGint4])]
688+-- '["public" ::: '["tab" ::: 'Table ('[] :=> '["col1" ::: 'NoDef :=> 'Null 'PGint4])]]
689-- definition = alterTable #tab (dropColumn #col2)
689-- definition = alterTable #tab (dropColumn #col2)
690-- in printSQL definition
690-- in printSQL definition
691-- :}
691-- :}
@@ -706,8 +706,8 @@ dropColumn column = UnsafeAlterTable $
706-- >>> :{
706-- >>> :{
707-- let
707-- let
708-- definition :: Definition
708-- definition :: Definition
709−-- '["tab" ::: 'Table ('[] :=> '["foo" ::: 'NoDef :=> 'Null 'PGint4])]
709+-- '["public" ::: '["tab" ::: 'Table ('[] :=> '["foo" ::: 'NoDef :=> 'Null 'PGint4])]]
710−-- '["tab" ::: 'Table ('[] :=> '["bar" ::: 'NoDef :=> 'Null 'PGint4])]
710+-- '["public" ::: '["tab" ::: 'Table ('[] :=> '["bar" ::: 'NoDef :=> 'Null 'PGint4])]]
711-- definition = alterTable #tab (renameColumn #foo #bar)
711-- definition = alterTable #tab (renameColumn #foo #bar)
712-- in printSQL definition
712-- in printSQL definition
713-- :}
713-- :}
@@ -751,8 +751,8 @@ newtype AlterColumn (db :: DBType) (ty0 :: ColumnType) (ty1 :: ColumnType) =
751-- >>> :{
751-- >>> :{
752-- let
752-- let
753-- definition :: Definition
753-- definition :: Definition
754−-- '["tab" ::: 'Table ('[] :=> '["col" ::: 'NoDef :=> 'Null 'PGint4])]
754+-- '["public" ::: '["tab" ::: 'Table ('[] :=> '["col" ::: 'NoDef :=> 'Null 'PGint4])]]
755−-- '["tab" ::: 'Table ('[] :=> '["col" ::: 'Def :=> 'Null 'PGint4])]
755+-- '["public" ::: '["tab" ::: 'Table ('[] :=> '["col" ::: 'Def :=> 'Null 'PGint4])]]
756-- definition = alterTable #tab (alterColumn #col (setDefault 5))
756-- definition = alterTable #tab (alterColumn #col (setDefault 5))
757-- in printSQL definition
757-- in printSQL definition
758-- :}
758-- :}
@@ -768,8 +768,8 @@ setDefault expression = UnsafeAlterColumn $
768-- >>> :{
768-- >>> :{
769-- let
769-- let
770-- definition :: Definition
770-- definition :: Definition
771−-- '["tab" ::: 'Table ('[] :=> '["col" ::: 'Def :=> 'Null 'PGint4])]
771+-- '["public" ::: '["tab" ::: 'Table ('[] :=> '["col" ::: 'Def :=> 'Null 'PGint4])]]
772−-- '["tab" ::: 'Table ('[] :=> '["col" ::: 'NoDef :=> 'Null 'PGint4])]
772+-- '["public" ::: '["tab" ::: 'Table ('[] :=> '["col" ::: 'NoDef :=> 'Null 'PGint4])]]
773-- definition = alterTable #tab (alterColumn #col dropDefault)
773-- definition = alterTable #tab (alterColumn #col dropDefault)
774-- in printSQL definition
774-- in printSQL definition
775-- :}
775-- :}
@@ -784,8 +784,8 @@ dropDefault = UnsafeAlterColumn $ "DROP DEFAULT"
784-- >>> :{
784-- >>> :{
785-- let
785-- let
786-- definition :: Definition
786-- definition :: Definition
787−-- '["tab" ::: 'Table ('[] :=> '["col" ::: 'NoDef :=> 'Null 'PGint4])]
787+-- '["public" ::: '["tab" ::: 'Table ('[] :=> '["col" ::: 'NoDef :=> 'Null 'PGint4])]]
788−-- '["tab" ::: 'Table ('[] :=> '["col" ::: 'NoDef :=> 'NotNull 'PGint4])]
788+-- '["public" ::: '["tab" ::: 'Table ('[] :=> '["col" ::: 'NoDef :=> 'NotNull 'PGint4])]]
789-- definition = alterTable #tab (alterColumn #col setNotNull)
789-- definition = alterTable #tab (alterColumn #col setNotNull)
790-- in printSQL definition
790-- in printSQL definition
791-- :}
791-- :}
@@ -799,8 +799,8 @@ setNotNull = UnsafeAlterColumn $ "SET NOT NULL"
799-- >>> :{
799-- >>> :{
800-- let
800-- let
801-- definition :: Definition
801-- definition :: Definition
802−-- '["tab" ::: 'Table ('[] :=> '["col" ::: 'NoDef :=> 'NotNull 'PGint4])]
802+-- '["public" ::: '["tab" ::: 'Table ('[] :=> '["col" ::: 'NoDef :=> 'NotNull 'PGint4])]]
803−-- '["tab" ::: 'Table ('[] :=> '["col" ::: 'NoDef :=> 'Null 'PGint4])]
803+-- '["public" ::: '["tab" ::: 'Table ('[] :=> '["col" ::: 'NoDef :=> 'Null 'PGint4])]]
804-- definition = alterTable #tab (alterColumn #col dropNotNull)
804-- definition = alterTable #tab (alterColumn #col dropNotNull)
805-- in printSQL definition
805-- in printSQL definition
806-- :}
806-- :}
@@ -816,8 +816,8 @@ dropNotNull = UnsafeAlterColumn $ "DROP NOT NULL"
816-- >>> :{
816-- >>> :{
817-- let
817-- let
818-- definition :: Definition
818-- definition :: Definition
819−-- '["tab" ::: 'Table ('[] :=> '["col" ::: 'NoDef :=> 'NotNull 'PGint4])]
819+-- '["public" ::: '["tab" ::: 'Table ('[] :=> '["col" ::: 'NoDef :=> 'NotNull 'PGint4])]]
820−-- '["tab" ::: 'Table ('[] :=> '["col" ::: 'NoDef :=> 'NotNull 'PGnumeric])]
820+-- '["public" ::: '["tab" ::: 'Table ('[] :=> '["col" ::: 'NoDef :=> 'NotNull 'PGnumeric])]]
821-- definition =
821-- definition =
822-- alterTable #tab (alterColumn #col (alterType (numeric & notNullable)))
822-- alterTable #tab (alterColumn #col (alterType (numeric & notNullable)))
823-- in printSQL definition
823-- in printSQL definition
@@ -831,9 +831,9 @@ alterType ty = UnsafeAlterColumn $ "TYPE" <+> renderColumnTypeExpression ty
831-- >>> :{
831-- >>> :{
832-- let
832-- let
833-- definition :: Definition
833-- definition :: Definition
834−-- '[ "abc" ::: 'Table ('[] :=> '["a" ::: 'NoDef :=> 'Null 'PGint4, "b" ::: 'NoDef :=> 'Null 'PGint4, "c" ::: 'NoDef :=> 'Null 'PGint4])]
834+-- '[ "public" ::: '["abc" ::: 'Table ('[] :=> '["a" ::: 'NoDef :=> 'Null 'PGint4, "b" ::: 'NoDef :=> 'Null 'PGint4, "c" ::: 'NoDef :=> 'Null 'PGint4])]]
835−-- '[ "abc" ::: 'Table ('[] :=> '["a" ::: 'NoDef :=> 'Null 'PGint4, "b" ::: 'NoDef :=> 'Null 'PGint4, "c" ::: 'NoDef :=> 'Null 'PGint4])
835+-- '[ "public" ::: '["abc" ::: 'Table ('[] :=> '["a" ::: 'NoDef :=> 'Null 'PGint4, "b" ::: 'NoDef :=> 'Null 'PGint4, "c" ::: 'NoDef :=> 'Null 'PGint4])
836−-- , "bc" ::: 'View ('["b" ::: 'Null 'PGint4, "c" ::: 'Null 'PGint4])]
836+-- , "bc" ::: 'View ('["b" ::: 'Null 'PGint4, "c" ::: 'Null 'PGint4])]]
837-- definition =
837-- definition =
838-- createView #bc (select (#b :* #c) (from (table #abc)))
838-- createView #bc (select (#b :* #c) (from (table #abc)))
839-- in printSQL definition
839-- in printSQL definition
@@ -854,9 +854,9 @@ createView alias query = UnsafeDefinition $
854-- >>> :{
854-- >>> :{
855-- let
855-- let
856-- definition :: Definition
856-- definition :: Definition
857−-- '[ "abc" ::: 'Table ('[] :=> '["a" ::: 'NoDef :=> 'Null 'PGint4, "b" ::: 'NoDef :=> 'Null 'PGint4, "c" ::: 'NoDef :=> 'Null 'PGint4])
857+-- '[ "public" ::: '["abc" ::: 'Table ('[] :=> '["a" ::: 'NoDef :=> 'Null 'PGint4, "b" ::: 'NoDef :=> 'Null 'PGint4, "c" ::: 'NoDef :=> 'Null 'PGint4])
858−-- , "bc" ::: 'View ('["b" ::: 'Null 'PGint4, "c" ::: 'Null 'PGint4])]
858+-- , "bc" ::: 'View ('["b" ::: 'Null 'PGint4, "c" ::: 'Null 'PGint4])]]
859−-- '[ "abc" ::: 'Table ('[] :=> '["a" ::: 'NoDef :=> 'Null 'PGint4, "b" ::: 'NoDef :=> 'Null 'PGint4, "c" ::: 'NoDef :=> 'Null 'PGint4])]
859+-- '[ "public" ::: '["abc" ::: 'Table ('[] :=> '["a" ::: 'NoDef :=> 'Null 'PGint4, "b" ::: 'NoDef :=> 'Null 'PGint4, "c" ::: 'NoDef :=> 'Null 'PGint4])]]
860-- definition = dropView #bc
860-- definition = dropView #bc
861-- in printSQL definition
861-- in printSQL definition
862-- :}
862-- :}
@@ -869,7 +869,7 @@ dropView vw = UnsafeDefinition $ "DROP VIEW" <+> renderQualifiedAlias vw <> ";"
869
869
870-- | Enumerated types are created using the `createTypeEnum` command, for example
870-- | Enumerated types are created using the `createTypeEnum` command, for example
871--
871--
872−-- >>> printSQL $ createTypeEnum #mood (label @"sad" :* label @"ok" :* label @"happy")
872+-- >>> printSQL $ (createTypeEnum #mood (label @"sad" :* label @"ok" :* label @"happy") :: Definition '["public" ::: '[]] '["public" ::: '["mood" ::: 'Typedef ('PGenum '["sad","ok","happy"])]])
873-- CREATE TYPE "mood" AS ENUM ('sad', 'ok', 'happy');
873-- CREATE TYPE "mood" AS ENUM ('sad', 'ok', 'happy');
874createTypeEnum
874createTypeEnum
875 :: (KnownSymbol enum, Has sch db schema, SOP.All KnownSymbol labels)
875 :: (KnownSymbol enum, Has sch db schema, SOP.All KnownSymbol labels)
@@ -887,7 +887,13 @@ createTypeEnum enum labels = UnsafeDefinition $
887-- >>> data Schwarma = Beef | Lamb | Chicken deriving GHC.Generic
887-- >>> data Schwarma = Beef | Lamb | Chicken deriving GHC.Generic
888-- >>> instance SOP.Generic Schwarma
888-- >>> instance SOP.Generic Schwarma
889-- >>> instance SOP.HasDatatypeInfo Schwarma
889-- >>> instance SOP.HasDatatypeInfo Schwarma
890+-- >>> :{
891+-- let
892+-- createSchwarma :: Definition '["public" ::: '[]] '["public" ::: '["schwarma" ::: 'Typedef (PG (Enumerated Schwarma))]]
890−-- >>> printSQL $ createTypeEnumFrom @Schwarma #schwarma
893+-- createSchwarma = createTypeEnumFrom @Schwarma #schwarma
894+-- in
895+-- printSQL createSchwarma
896+-- :}
891-- CREATE TYPE "schwarma" AS ENUM ('Beef', 'Lamb', 'Chicken');
897-- CREATE TYPE "schwarma" AS ENUM ('Beef', 'Lamb', 'Chicken');
892createTypeEnumFrom
898createTypeEnumFrom
893 :: forall hask sch enum db schema.
899 :: forall hask sch enum db schema.
@@ -912,7 +918,7 @@ type PGcomplex = 'PGcomposite
912
918
913>>> :{
919>>> :{
914let
920let
915− setup :: Definition '[] '["complex" ::: 'Typedef PGcomplex]
921+ setup :: Definition '["public" ::: '[]] '["public" ::: '["complex" ::: 'Typedef PGcomplex]]
916 setup = createTypeComposite #complex
922 setup = createTypeComposite #complex
917 (float8 `as` #real :* float8 `as` #imaginary)
923 (float8 `as` #real :* float8 `as` #imaginary)
918in printSQL setup
924in printSQL setup
@@ -939,7 +945,14 @@ createTypeComposite ty fields = UnsafeDefinition $
939-- >>> data Complex = Complex {real :: Double, imaginary :: Double} deriving GHC.Generic
945-- >>> data Complex = Complex {real :: Double, imaginary :: Double} deriving GHC.Generic
940-- >>> instance SOP.Generic Complex
946-- >>> instance SOP.Generic Complex
941-- >>> instance SOP.HasDatatypeInfo Complex
947-- >>> instance SOP.HasDatatypeInfo Complex
948+-- >>> type DB = '["public" ::: '["complex" ::: 'Typedef (PG (Composite Complex))]]
949+-- >>> :{
950+-- let
951+-- createComplex :: Definition '["public" ::: '[]] DB
942−-- >>> printSQL $ createTypeCompositeFrom @Complex #complex
952+-- createComplex = createTypeCompositeFrom @Complex #complex
953+-- in
954+-- printSQL createComplex
955+-- :}
943-- CREATE TYPE "complex" AS ("real" float8, "imaginary" float8);
956-- CREATE TYPE "complex" AS ("real" float8, "imaginary" float8);
944createTypeCompositeFrom
957createTypeCompositeFrom
945 :: forall hask sch ty db schema.
958 :: forall hask sch ty db schema.
@@ -964,7 +977,7 @@ instance (KnownSymbol alias, PGTyped db ty)
964-- >>> data Schwarma = Beef | Lamb | Chicken deriving GHC.Generic
977-- >>> data Schwarma = Beef | Lamb | Chicken deriving GHC.Generic
965-- >>> instance SOP.Generic Schwarma
978-- >>> instance SOP.Generic Schwarma
966-- >>> instance SOP.HasDatatypeInfo Schwarma
979-- >>> instance SOP.HasDatatypeInfo Schwarma
967−-- >>> printSQL (dropType #schwarma :: Definition '["schwarma" ::: 'Typedef (PG (Enumerated Schwarma))] '[])
980+-- >>> printSQL (dropType #schwarma :: Definition '["public" ::: '["schwarma" ::: 'Typedef (PG (Enumerated Schwarma))]] '["public" ::: '[]])
968-- DROP TYPE "schwarma";
981-- DROP TYPE "schwarma";
969dropType
982dropType
970 :: (Has sch db schema, Has td schema ('Typedef ty))
983 :: (Has sch db schema, Has td schema ('Typedef ty))
squeal-postgresql/src/Squeal/PostgreSQL/Expression.hs+1−1
@@ -484,7 +484,7 @@ row exprs = UnsafeExpression $ "ROW" <> parenthesized
484--
484--
485-- >>> let i = row (0 `as` #real :* 1 `as` #imaginary) :: Expression DB from grp params ('NotNull Complex)
485-- >>> let i = row (0 `as` #real :* 1 `as` #imaginary) :: Expression DB from grp params ('NotNull Complex)
486-- >>> printSQL $ i & field #complex #imaginary
486-- >>> printSQL $ i & field #complex #imaginary
487−-- (ROW(0, 1)::"public"."complex")."imaginary"
487+-- (ROW(0, 1)::"complex")."imaginary"
488field
488field
489 :: ( Has sch db schema
489 :: ( Has sch db schema
490 , Has tydef schema ('Typedef ('PGcomposite row))
490 , Has tydef schema ('Typedef ('PGcomposite row))
squeal-postgresql/src/Squeal/PostgreSQL/Manipulation.hs+16−16
@@ -65,9 +65,9 @@ simple insert:
65>>> :{
65>>> :{
66let
66let
67 manipulation :: Manipulation
67 manipulation :: Manipulation
68− '[ "tab" ::: 'Table ('[] :=>
68+ '[ "public" ::: '["tab" ::: 'Table ('[] :=>
69 '[ "col1" ::: 'NoDef :=> 'NotNull 'PGint4
69 '[ "col1" ::: 'NoDef :=> 'NotNull 'PGint4
70− , "col2" ::: 'Def :=> 'NotNull 'PGint4 ])] '[] '[]
70+ , "col2" ::: 'Def :=> 'NotNull 'PGint4 ])]] '[] '[]
71 manipulation =
71 manipulation =
72 insertRow_ #tab (Set 2 `as` #col1 :* Default `as` #col2)
72 insertRow_ #tab (Set 2 `as` #col1 :* Default `as` #col2)
73in printSQL manipulation
73in printSQL manipulation
@@ -79,9 +79,9 @@ parameterized insert:
79>>> :{
79>>> :{
80let
80let
81 manipulation :: Manipulation
81 manipulation :: Manipulation
82− '[ "tab" ::: 'Table ('[] :=>
82+ '[ "public" ::: '["tab" ::: 'Table ('[] :=>
83 '[ "col1" ::: 'NoDef :=> 'NotNull 'PGint4
83 '[ "col1" ::: 'NoDef :=> 'NotNull 'PGint4
84− , "col2" ::: 'NoDef :=> 'NotNull 'PGint4 ])]
84+ , "col2" ::: 'NoDef :=> 'NotNull 'PGint4 ])]]
85 '[ 'NotNull 'PGint4, 'NotNull 'PGint4 ] '[]
85 '[ 'NotNull 'PGint4, 'NotNull 'PGint4 ] '[]
86 manipulation =
86 manipulation =
87 insertRow_ #tab
87 insertRow_ #tab
@@ -95,9 +95,9 @@ returning insert:
95>>> :{
95>>> :{
96let
96let
97 manipulation :: Manipulation
97 manipulation :: Manipulation
98− '[ "tab" ::: 'Table ('[] :=>
98+ '[ "public" ::: '["tab" ::: 'Table ('[] :=>
99 '[ "col1" ::: 'NoDef :=> 'NotNull 'PGint4
99 '[ "col1" ::: 'NoDef :=> 'NotNull 'PGint4
100− , "col2" ::: 'Def :=> 'NotNull 'PGint4 ])] '[]
100+ , "col2" ::: 'Def :=> 'NotNull 'PGint4 ])]] '[]
101 '["fromOnly" ::: 'NotNull 'PGint4]
101 '["fromOnly" ::: 'NotNull 'PGint4]
102 manipulation =
102 manipulation =
103 insertRow #tab (Set 2 `as` #col1 :* Default `as` #col2)
103 insertRow #tab (Set 2 `as` #col1 :* Default `as` #col2)
@@ -111,9 +111,9 @@ upsert:
111>>> :{
111>>> :{
112let
112let
113 manipulation :: Manipulation
113 manipulation :: Manipulation
114− '[ "tab" ::: 'Table ('[] :=>
114+ '[ "public" ::: '["tab" ::: 'Table ('[] :=>
115 '[ "col1" ::: 'NoDef :=> 'NotNull 'PGint4
115 '[ "col1" ::: 'NoDef :=> 'NotNull 'PGint4
116− , "col2" ::: 'NoDef :=> 'NotNull 'PGint4 ])]
116+ , "col2" ::: 'NoDef :=> 'NotNull 'PGint4 ])]]
117 '[] '[ "sum" ::: 'NotNull 'PGint4]
117 '[] '[ "sum" ::: 'NotNull 'PGint4]
118 manipulation =
118 manipulation =
119 insertRows #tab
119 insertRows #tab
@@ -132,7 +132,7 @@ query insert:
132>>> :{
132>>> :{
133let
133let
134 manipulation :: Manipulation
134 manipulation :: Manipulation
135− '[ "tab" ::: 'Table ('[] :=>
135+ '[ "public" ::: '["tab" ::: 'Table ('[] :=>
136 '[ "col1" ::: 'NoDef :=> 'NotNull 'PGint4
136 '[ "col1" ::: 'NoDef :=> 'NotNull 'PGint4
137 , "col2" ::: 'NoDef :=> 'NotNull 'PGint4
137 , "col2" ::: 'NoDef :=> 'NotNull 'PGint4
138 ])
138 ])
@@ -140,7 +140,7 @@ let
140 '[ "col1" ::: 'NoDef :=> 'NotNull 'PGint4
140 '[ "col1" ::: 'NoDef :=> 'NotNull 'PGint4
141 , "col2" ::: 'NoDef :=> 'NotNull 'PGint4
141 , "col2" ::: 'NoDef :=> 'NotNull 'PGint4
142 ])
142 ])
143− ] '[] '[]
143+ ]] '[] '[]
144 manipulation =
144 manipulation =
145 insertQuery_ #tab
145 insertQuery_ #tab
146 (selectStar (from (table (#other_tab `as` #t))))
146 (selectStar (from (table (#other_tab `as` #t))))
@@ -153,9 +153,9 @@ update:
153>>> :{
153>>> :{
154let
154let
155 manipulation :: Manipulation
155 manipulation :: Manipulation
156− '[ "tab" ::: 'Table ('[] :=>
156+ '[ "public" ::: '["tab" ::: 'Table ('[] :=>
157 '[ "col1" ::: 'NoDef :=> 'NotNull 'PGint4
157 '[ "col1" ::: 'NoDef :=> 'NotNull 'PGint4
158− , "col2" ::: 'NoDef :=> 'NotNull 'PGint4 ])] '[] '[]
158+ , "col2" ::: 'NoDef :=> 'NotNull 'PGint4 ])]] '[] '[]
159 manipulation =
159 manipulation =
160 update_ #tab (Set 2 `as` #col1 :* Same `as` #col2)
160 update_ #tab (Set 2 `as` #col1 :* Same `as` #col2)
161 (#col1 ./= #col2)
161 (#col1 ./= #col2)
@@ -168,9 +168,9 @@ delete:
168>>> :{
168>>> :{
169let
169let
170 manipulation :: Manipulation
170 manipulation :: Manipulation
171− '[ "tab" ::: 'Table ('[] :=>
171+ '[ "public" ::: '["tab" ::: 'Table ('[] :=>
172 '[ "col1" ::: 'NoDef :=> 'NotNull 'PGint4
172 '[ "col1" ::: 'NoDef :=> 'NotNull 'PGint4
173− , "col2" ::: 'NoDef :=> 'NotNull 'PGint4 ])] '[]
173+ , "col2" ::: 'NoDef :=> 'NotNull 'PGint4 ])]] '[]
174 '[ "col1" ::: 'NotNull 'PGint4
174 '[ "col1" ::: 'NotNull 'PGint4
175 , "col2" ::: 'NotNull 'PGint4 ]
175 , "col2" ::: 'NotNull 'PGint4 ]
176 manipulation = deleteFrom #tab (#col1 .== #col2) ReturningStar
176 manipulation = deleteFrom #tab (#col1 .== #col2) ReturningStar
@@ -185,9 +185,9 @@ with manipulation:
185>>> :{
185>>> :{
186let
186let
187 manipulation :: Manipulation
187 manipulation :: Manipulation
188− '[ "products" ::: 'Table ProductsTable
188+ '[ "public" ::: '["products" ::: 'Table ProductsTable
189 , "products_deleted" ::: 'Table ProductsTable
189 , "products_deleted" ::: 'Table ProductsTable
190− ] '[ 'NotNull 'PGdate] '[]
190+ ]] '[ 'NotNull 'PGdate] '[]
191 manipulation = with
191 manipulation = with
192 (deleteFrom #products (#date .< param @1) ReturningStar `as` #deleted_rows)
192 (deleteFrom #products (#date .< param @1) ReturningStar `as` #deleted_rows)
193 (insertQuery_ #products_deleted (selectStar (from (view (#deleted_rows `as` #t)))))
193 (insertQuery_ #products_deleted (selectStar (from (view (#deleted_rows `as` #t)))))
squeal-postgresql/src/Squeal/PostgreSQL/Schema.hs+1−1
@@ -495,7 +495,7 @@ renderQualifiedAlias _ =
495 qualifier = renderAlias (Alias @q)
495 qualifier = renderAlias (Alias @q)
496 alias = renderAlias (Alias @a)
496 alias = renderAlias (Alias @a)
497 in
497 in
498− if qualifier == "public" then alias else qualifier <> "." <> alias
498+ if qualifier == "\"public\"" then alias else qualifier <> "." <> alias
499
499
500-- | @Elem@ is a promoted `Data.List.elem`.
500-- | @Elem@ is a promoted `Data.List.elem`.
501type family Elem x xs where
501type family Elem x xs where