You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is my second attempt at writing code to select the latest version of each of a given type of document. Both have resulted in run-time errors. Here is the current offending version of the code, and below is the run-time error being produced.
For reference, the schema includes the following columns, which are used in the snippet below:
, type' ::ColumnarfAgreementType
, version ::ColumnarfNatural
--| The latest version of each of the requested agreement types.latestVersions::
[AgreementType] ->QPostgresUserAccountServiceDbs (AgreementT (QExprPostgress))
latestVersions types =do
(expectedType, expectedVersion) <- aggregate_
(\Schema.Agreement.Agreement{..} -> (group_ type', firstValue_ version))
$ orderBy_ (desc_ . (.version))
$ filter_ (\Schema.Agreement.Agreement{..} -> type' `in_` (val_ <$> types))
$ all_ userAccountServiceDb.agreementTable
filter_ (\Schema.Agreement.Agreement{..} ->
type' ==. expectedType &&. version ==. expectedVersion)
$ all_ userAccountServiceDb.agreementTable
SqlError {sqlState ="42809", sqlExecStatus =FatalError, sqlErrorMsg ="window function first_value requires an OVER clause", sqlErrorDetail ="", sqlErrorHint =""}
The text was updated successfully, but these errors were encountered:
This is my second attempt at writing code to select the latest version of each of a given type of document. Both have resulted in run-time errors. Here is the current offending version of the code, and below is the run-time error being produced.
For reference, the schema includes the following columns, which are used in the snippet below:
The text was updated successfully, but these errors were encountered: