diff --git a/src/PostgREST/DbStructure.hs b/src/PostgREST/DbStructure.hs index 8e571d35b..e3d563d18 100644 --- a/src/PostgREST/DbStructure.hs +++ b/src/PostgREST/DbStructure.hs @@ -98,10 +98,10 @@ decodeRels tables cols = <$> column HD.text <*> column HD.text <*> column HD.text - <*> column (HD.array (HD.dimension replicateM (element HD.text))) + <*> arrayColumn HD.text <*> column HD.text <*> column HD.text - <*> column (HD.array (HD.dimension replicateM (element HD.text))) + <*> arrayColumn HD.text decodePks :: [Table] -> HD.Result [PrimaryKey] decodePks tables = diff --git a/src/PostgREST/Private/Common.hs b/src/PostgREST/Private/Common.hs index c1acc9258..006c4e68c 100644 --- a/src/PostgREST/Private/Common.hs +++ b/src/PostgREST/Private/Common.hs @@ -15,8 +15,8 @@ column = HD.column . HD.nonNullable nullableColumn :: HD.Value a -> HD.Row (Maybe a) nullableColumn = HD.column . HD.nullable -element :: HD.Value a -> HD.Array a -element = HD.element . HD.nonNullable +arrayColumn :: HD.Value a -> HD.Row [a] +arrayColumn = column . HD.array . HD.dimension replicateM . HD.element . HD.nonNullable param :: HE.Value a -> HE.Params a param = HE.param . HE.nonNullable diff --git a/src/PostgREST/Statements.hs b/src/PostgREST/Statements.hs index b3334620b..3acdd7419 100644 --- a/src/PostgREST/Statements.hs +++ b/src/PostgREST/Statements.hs @@ -120,11 +120,9 @@ createReadStatement selectQuery countQuery isSingle countTotal asCsv binaryField -} standardRow :: HD.Row ResultsWithCount standardRow = (,,,,,) <$> nullableColumn HD.int8 <*> column HD.int8 - <*> column header <*> column HD.bytea + <*> arrayColumn HD.bytea <*> column HD.bytea <*> (fromMaybe (Right []) <$> nullableColumn decodeGucHeaders) <*> (fromMaybe (Right Nothing) <$> nullableColumn decodeGucStatus) - where - header = HD.array $ HD.dimension replicateM $ element HD.bytea type ProcResults = (Maybe Int64, Int64, ByteString, Either SimpleError [GucHeader], Either SimpleError (Maybe Status))