Skip to content
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

GORM with Postgres: 'information_schema' does not exist #97

Open
MrSpoony opened this issue Nov 1, 2023 · 1 comment
Open

GORM with Postgres: 'information_schema' does not exist #97

MrSpoony opened this issue Nov 1, 2023 · 1 comment

Comments

@MrSpoony
Copy link

MrSpoony commented Nov 1, 2023

I tried to use the example in the readme to create a gorm database:

minimal example:

package main

import (
	"database/sql"
	"log"

	_ "github.com/proullon/ramsql/driver"

	"gorm.io/driver/postgres"
	"gorm.io/gorm"
)

type Product struct {
	gorm.Model
}

// From the example in the readme
func main() {
	ramdb, err := sql.Open("ramsql", "TestGormQuickStart")
	if err != nil {
		log.Fatal(err)
	}
	db, err := gorm.Open(postgres.New(postgres.Config{Conn: ramdb}), &gorm.Config{})
	if err != nil {
		log.Fatal(err)
	}

	// Migrate the schema
	err = db.AutoMigrate(&Product{})
	if err != nil {
		log.Fatal(err)
	}
}

When I try to run this I get the following error:
schema 'information_schema' does not exist
[0.160ms] [rows:-] SELECT count(*) FROM information_schema.tables WHERE table_schema = CURRENT_SCHEMA() AND table_name = 'products' AND table_type = 'BASE TABLE'

@Mcklmo
Copy link

Mcklmo commented Dec 15, 2023

I'm getting the same error. Please fix!

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

No branches or pull requests

2 participants