hasura / hasura/graphql-engine
`hasura seed create --from-table` strips blank lines in text column contents
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Version Information
Server Version: 2.23.0
CLI Version (for CLI related issue): 2.23.0
### Environment
OSS.
### What is the current behaviour?
While creating a seed from table data:
```shell
hasura seed create 'foo_table_seed' --from-table 'foo_table' --database-name 'default'
```
If one of the table columns is a text column that contains multi-line text, all blank lines from such text will be removed in the resulting seed.
### What is the expected behaviour?
Data in text columns should be preserved as-is
### How to reproduce the issue?
1. Create a table (e.g., `foo_table`) with a text column, then insert a row where the text column contains multi-line text with a mix of blank and non-blank lines.
2. Create a seed from the table data: `hasura seed create 'foo_table_seed' --from-table 'foo_table' --database-name 'default'`.
3. Open the created seed file and you'll see that `INSERT` statements contain text data without blank lines.
### Screenshots or Screencast
N/A
### Please provide any traces or logs that could help here.
N/A
### Any possible solutions/workarounds you're aware of?
I think I've traced this behavior to `hasura seed create` hard-cording true in the `clean_output` argument of a PG dump API:
- https://github.com/hasura/graphql-engine/blob/master/cli/seed/create.go#L86
- https://github.com/hasura/graphql-engine/blob/8c21c18a999bc773b054e1962ba901d097e586fe/server/src-lib/Hasura/Server/API/PGDump.hs#L61-L63
When set to true, the argument results in dropping blank lines, comments, "front matter" and notify triggers in a PG dump. I wonder if the cleaning logic could be improved to avoid stripping blank lines in column content. Raw PG dumps do not strip blank lines--I tested that with `pg_dump --no-owner --no-acl --data-only --column-inserts --table '' `.
### Keywords
seed, create, clean, output, blank line
Contributor guide
Assessment
This issue has not been assessed yet.