squeal-postgresql v0.7.0.1 Release Notes
Release Date: 2020-10-01 // about 4 years ago-
๐ Version 0.7
Thanks to Samuel Schlesinger, Adam Wespiser, Cullin Poreski,
Matthew Doty and Mark Wotton for tons of contributions.
๐ Version 0.7 of Squeal makes many changes.Inter-schema Foreign Key Bug
Unfortunately, there was a bug in inter-schema foreign keys in previous
๐ versions of Squeal. Essentially, it was erroneously assumed that
foreign keys always point to tables in the public schema. To remedy this
theForeignKey
type has changed kind from\>\>\> :kind 'ForeignKey 'ForeignKey :: [Symbol] -\> Symbol -\> [Symbol] -\> TableConstraint
to
\>\>\> :kind 'ForeignKey 'ForeignKey :: [Symbol] -\> Symbol -\> Symbol -\> [Symbol] -\> TableConstraint
โฌ๏ธ To upgrade your database schemas type, you will have to change, e.g.
'ForeignKey '["foo\_id1", "foo\_id2"] "foo" '["id1", "id2"]
to
'ForeignKey '["foo\_id1", "foo\_id2"] "public" "foo" '["id1", "id2"]
Locking Clauses
You can now add row level locking clauses to your
select
queriesPolymorphic Lateral Contexts
Previously, lateral contexts which are used for lateral joins
and subquery expressions had to have monomorphic lateral contexts,
which greatly reduced composability of queries involving lateral
๐ joins. Squeal 0.7 fixes this limitation, making it possible to
have polymorphic lateral context! When looking up a column heretofore,
the relevant typeclasses would search throughJoin lat from
.
This is the "correct" ordering as far as the structure from
left to right in the query, making lat consistently ordered as
one goes through nested lateral joins or nested subquery expressions.
However, it doesn't really matter how the lookup orders the columns.
And if the lookup searches through Join from lat instead then thanks
to good old Haskell lazy list appending, if a query only references
columns in from then it will work no matter the lat.
With a small proviso; if you leave lat polymorphic,
then you must qualify all columns since there could be more than
one table even if from has only one table in it.Decoders
The
DecodeRow
Monad
now has aMonadFail
instance.๐ New row decoder combinators have been added. The functions
๐appendRows
andconsRow
let you build row decoders up
from pieces.Previously, Squeal made it easy to decode enum types to Haskell
enum types (sum types with nullary constructors) so long as
the Haskell type exactly matches the enum type. However, because
of limitations in Haskell - constructors must be capitalized,
name conflicts are often disambiguated with extra letters, etc -
it's often the case that their constructors won't exactly match the
Postgres enum type's labels. The new functionenumValue
allows
to define typesafe custom enum decoders, similar to howrowValue
๐ allows to define typesafe custom composite decoders.\>\>\> :{data Dir = North | East | South | Westinstance IsPG Dir wheretype PG Dir = 'PGenum '["north", "south", "east", "west"]instance FromPG Dir where fromPG = enumValue $ label @"north" North :\* label @"south" South :\* label @"east" East :\* label @"west" West:}
Definitions
๐ New DDL statements have been added allowing to rename and
reset the schema of different schemum objects. Also, new DDL statements
have been added for adding comments to schemum objects.Procedures
๐ Squeal now supports procedure definitions and calls.
cmdTuples and cmdStatus
The
cmdTuples
andcmdStatus
functions fromLibPQ
are now
included.PQ Monad Instances
the
PQ
Monad
has been given instances forMonadCatch
,
MonadThrow
,MonadMask
,MonadBase
,MonadBaseControl
, and
MonadTransControl
.Referential Actions
A new type
ReferentialAction
has been factored out of
โก๏ธOnDeleteClause
s andOnUpdateClause
s. And Missing actions,
0๏ธโฃSetNotNull
andSetDefault
are now included.โฌ๏ธ To upgrade, change from e.g.
OnDeleteCascade
toOnDelete Cascade
.Array functions
๐ Squeal now offers typesafe indexing for fixed length arrays and matrices,
with new functionsindex1
andindex2
. And new functionsarrAny
andarrAll
have been added to enable comparisons to any or all elements
of a variable length array.Manipulations
โก๏ธ Tables being manipulated are now re-aliasable, and updates can reference
"from" clauses, actually calledUsingClause
s in Squeal, similar to deletes.Other changes
๐ New tests and bugfixes have been added. More support for encoding and decoding
of different types has been added. Time values now useiso8601
formatting
๐ท for inlining. Also, the GitHub repo has moved from using Circle CI to using
โ GitHub Actions for continuous integration testing.
Previous changes from v0.6.0.2
-
๐ Fix documentation for
defaultMode
for transactions.