`apply` does not correctly use upper case schemas with `--schema`
Followup on #6
Thanks for the quick fix!
Unfortunately, it only seems to work for schema names that contain only lowercase characters. However, if I have a schema like "GFJTA" it doesn't:
PGPASSWORD=bar pgschema apply --host localhost --db my_db --user foo --schema "GFJTA" --port 5432 --plan=plan.json
[...]
Error: failed to execute concatenated statements in group 2: ERROR: schema "gfjta" does not exist (SQLSTATE 3F000)
failed to execute concatenated statements in group 2: ERROR: schema "gfjta" does not exist (SQLSTATE 3F000)
However, plan seems to understand the uppercase.
Fixed. Thanks for reporting
Unfortunately the fix didn't seem to work.
I just installed the latest (1.1.0), yet I'm getting:
PGPASSWORD=bar pgschema apply --host localhost --db plants --user foo --schema "GFJTA" --port 5432 --plan=plan.json
...
Set search_path to: "GFJTA", public
Executing group 1/2...
Executing 1 statements in implicit transaction
Error: failed to execute concatenated statements in group 1: ERROR: schema "gfjta" does not exist (SQLSTATE 3F000)
Am I doing something wrong?
This seems to work from my side
tianzhou:~/Desktop/pgschema$ pgschema plan --file /tmp/schema.sql --schema "GFJTA" --output-json /tmp/plan.json
tianzhou:~/Desktop/pgschema$ pgschema apply --schema "GFJTA" --plan /tmp/plan.json
Plan: 2 to add.
Summary by type:
tables: 2 to add
Tables:
DDL to be executed:
--------------------------------------------------
CREATE TABLE IF NOT EXISTS t2 (
id SERIAL PRIMARY KEY
);
CREATE TABLE IF NOT EXISTS test_table (
id text PRIMARY KEY,
provider_id text NOT NULL,
account_id text NOT NULL,
UNIQUE (provider_id, account_id)
);
Do you want to apply these changes? (yes/no): yes
Applying changes...
Set search_path to: "GFJTA", public
Executing group 1/1...
Executing 2 statements in implicit transaction
Changes applied successfully!
Have you regenerated the plan file?
My plan file looks like this :
{
"version": "1.0.0",
"pgschema_version": "1.1.0",
"created_at": "2025-09-17T15:35:13+08:00",
"source_fingerprint": {
"hash": "dc09fa0205ad179a38eef88b73bdcfe634dc0c943e06fde90b3cb4e9b052df97"
},
"groups": [
{
"steps": [
{
"sql": "CREATE TABLE IF NOT EXISTS t2 (\n id SERIAL PRIMARY KEY\n);",
"type": "table",
"operation": "create",
"path": "GFJTA.t2"
},
{
"sql": "CREATE TABLE IF NOT EXISTS test_table (\n id text PRIMARY KEY,\n provider_id text NOT NULL,\n account_id text NOT NULL,\n UNIQUE (provider_id, account_id)\n);",
"type": "table",
"operation": "create",
"path": "GFJTA.test_table"
}
]
}
]
}
First of all sorry for incorrectly reporting this.
It turns out I still had an old version of pgschema on my path. Everything works fine with newer versions.
Also sorry for the late response, took me a while to get to it.