hasura / hasura/graphql-engine
--from-server flag is not working for schemas having capital letters (postgres).
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Version Information
Server Version:
v2.37.0
CLI Version (for CLI related issue):
v2.29.0
### Environment
Self Hosted
### What is the current behaviour?
What i want to do is - Let's say I have one database and I am having two schemas called `TEST` and `test`
When I try to hit the command :
```hasura migrate create "init" --from-server --schema test```
It works perfectly fine and expected result comes - which is my migration file is being created.
However for the schema `TEST` when i run
```hasura migrate create "init" --from-server --schema TEST```
it says;
```
FATA[0002] cannot fetch schema dump: pg_dump request: 500
{
"error": "error while executing pg_dump",
"path": "$",
"code": "unexpected",
"internal": "pg_dump: error: no matching schemas were found\n"
}
```
---
When I did this in pg_dump it said the same thing; "TEST" does not exist.
But, For pg_dump we can overcome this using this;
`pg_dump -n \"TEST\" `
since it's postgres way to always allow small chars in schema and i completely misunderstood that, huh?
### What is the expected behaviour?
What I would like is having something like:
```hasura migrate create "init" --from-server --schema \"TEST\"```
### Keywords
pg_dump, --from-server, migrations
Contributor guide
Research direction
Start by reproducing the issue with `hasura migrate create "init" --from-server --schema TEST`, then trace the CLI handling of `--schema` and the request that invokes `pg_dump`. The work is done when an uppercase schema is passed correctly and the command creates its migration, with regression coverage for both quoted and unquoted schema names.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgres
- Domain
- cli, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100