-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] gprestore report : -ERROR: schema "gp_toolkit" does not exist (SQLSTATE 3F000) #681
[Bug] gprestore report : -ERROR: schema "gp_toolkit" does not exist (SQLSTATE 3F000) #681
Comments
Hey, @RealGrayRabbit welcome!🎊 Thanks for taking the time to point this out.🙌 |
Hi @Terry1504 , could you please have a look at it when have time? Thanks |
reproduce:
and use the issue steps reason:
how to solve it:diff --git a/backup/predata_functions.go b/backup/predata_functions.go
index 61cd31d..e7a9bae 100644
--- a/backup/predata_functions.go
+++ b/backup/predata_functions.go
@@ -278,7 +278,10 @@ func PrintCreateCastStatement(metadataFile *utils.FileWithByteCount, toc *toc.TO
func PrintCreateExtensionStatements(metadataFile *utils.FileWithByteCount, toc *toc.TOC, extensionDefs []Extension, extensionMetadata MetadataMap) {
for _, extensionDef := range extensionDefs {
start := metadataFile.ByteCount
- metadataFile.MustPrintf("\n\nSET search_path=%s,pg_catalog;\nCREATE EXTENSION IF NOT EXISTS %s WITH SCHEMA %s;\nSET search_path=pg_catalog;", extensionDef.Schema, extensionDef.Name, extensionDef.Schema)
+ metadataFile.MustPrintf(
+ "\n\nCREATE SCHEMA IF NOT EXISTS %[1]s;\nSET search_path=%[1]s,pg_catalog;\nCREATE EXTENSION IF NOT EXISTS %[2]s WITH SCHEMA %[1]s;\nSET search_path=pg_catalog;\n",
+ extensionDef.Schema, extensionDef.Name)
+
section, entry := extensionDef.GetMetadataEntry()
toc.AddMetadataEntry(section, entry, start, metadataFile.ByteCount) you can change the code in https://github.com/cloudberrydb/gpbackup
you can fix the issue |
Hi @yihong0618 Great catch! Would you like to help submit one PR to the |
yes but maybe later next week a little busy these days |
Great work @yihong0618 |
Cloudberry Database version
PostgreSQL 14.4 (Cloudberry Database 1.6.0 build 1) on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-22), 64-bit compiled on Sep 3 2024 07:22:14
(1 row)
What happened
System can not use gprestore to restore database. The case is descripted as below:
Step 1: gpbackup --dbname cloudberry
Step 2: dropdb cloudberry
Why and how to resolve it?
What you think should happen instead
Since I use gpbackup and gprestore as user manual, It shall be able to restore the backed database normally.
But it seems that gprestore can not create system schema "gp_toolkit"!
How to reproduce
As descripted in "What happen" section.
Operating System
Rocky Linux release 8.10 (Green Obsidian)
Anything else
No response
Are you willing to submit PR?
Code of Conduct
The text was updated successfully, but these errors were encountered: