haskell-beam / haskell-beam/beam

postgres composition type support

Open
#309 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
635
Forks
193
PR merge metrics
No merged PRs in 30d

Description

we use the composite types feature of postgres
https://www.postgresql.org/docs/10/static/rowtypes.html

If I query a table such as:
```haskell
data Version
= Version
{ major :: Int
, minor :: Int
}
data FooBar
= FooBar
{ foo :: Text
, bar :: Version
}
```

the generated SQL looks like.

```sql
SELECT "t0"."foo" AS "res0", "t0"."version__major" AS "res1", "t0"."version__minor" AS "res2" FROM "FooBar" AS "t0"
```

Is there a way to get the query to output something along the lines of:

```sql
SELECT "t0"."foo" AS "res0", "(t0.version).major" AS "res1", "(t0.version).minor" AS "res2" FROM "FooBar" AS "t0"
```
?
I saw this comment https://github.com/tathougies/beam/blob/01bbb89c03b93daa2500877a511159df9d91002a/beam-core/test/Database/Beam/Test/SQL.hs#L785 which makes me think this is possible and I missed it in the docs.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.