k1LoW / tbls

tbls is a CI-Friendly tool for document a database, written in Go.
MIT License
3.4k stars 166 forks source link

[Error] pq: CASE types "char" and text cannot be matched #382

Closed goliatone closed 1 year ago

goliatone commented 1 year ago

What happened

Ran command tbls doc -c .tbls.yml and got the following output:

pq: CASE types "char" and text cannot be matched

What you expected to happened

Generate docs

What stack trace or error message from tbls did you see?

pq: CASE types "char" and text cannot be matched
github.com/k1LoW/tbls/drivers/postgres.(*Postgres).getFunctionsByQuery
        /Users/runner/work/tbls/tbls/drivers/postgres/postgres.go:446
github.com/k1LoW/tbls/drivers/postgres.(*Postgres).getFunctions
        /Users/runner/work/tbls/tbls/drivers/postgres/postgres.go:429
github.com/k1LoW/tbls/drivers/postgres.(*Postgres).Analyze
        /Users/runner/work/tbls/tbls/drivers/postgres/postgres.go:300
github.com/k1LoW/tbls/datasource.Analyze
        /Users/runner/work/tbls/tbls/datasource/datasource.go:118
github.com/k1LoW/tbls/cmd.glob..func5
        /Users/runner/work/tbls/tbls/cmd/doc.go:70
github.com/spf13/cobra.(*Command).execute
        /Users/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:856
github.com/spf13/cobra.(*Command).ExecuteC
        /Users/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:974
github.com/spf13/cobra.(*Command).Execute
        /Users/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:902
github.com/k1LoW/tbls/cmd.Execute
        /Users/runner/work/tbls/tbls/cmd/root.go:180
main.main
        /Users/runner/work/tbls/tbls/main.go:34
runtime.main
        /usr/local/Cellar/go/1.19.2/libexec/src/runtime/proc.go:250
runtime.goexit
        /usr/local/Cellar/go/1.19.2/libexec/src/runtime/asm_arm64.s:1172
github.com/k1LoW/tbls/drivers/postgres.(*Postgres).getFunctions
        /Users/runner/work/tbls/tbls/drivers/postgres/postgres.go:431
github.com/k1LoW/tbls/drivers/postgres.(*Postgres).Analyze
        /Users/runner/work/tbls/tbls/drivers/postgres/postgres.go:300
github.com/k1LoW/tbls/datasource.Analyze
        /Users/runner/work/tbls/tbls/datasource/datasource.go:118
github.com/k1LoW/tbls/cmd.glob..func5
        /Users/runner/work/tbls/tbls/cmd/doc.go:70
github.com/spf13/cobra.(*Command).execute
        /Users/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:856
github.com/spf13/cobra.(*Command).ExecuteC
        /Users/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:974
github.com/spf13/cobra.(*Command).Execute
        /Users/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:902
github.com/k1LoW/tbls/cmd.Execute
        /Users/runner/work/tbls/tbls/cmd/root.go:180
main.main
        /Users/runner/work/tbls/tbls/main.go:34
runtime.main
        /usr/local/Cellar/go/1.19.2/libexec/src/runtime/proc.go:250
runtime.goexit
        /usr/local/Cellar/go/1.19.2/libexec/src/runtime/asm_arm64.s:1172

Anything else we need to know?

Environment

dsn: postgres://usr:pwd@localhost:5432/project_db?sslmode=disable
docPath: doc/schema
k1LoW commented 1 year ago

@goliatone Thank you for your report! Can you provide a DDL that can reproduce this error?

goliatone commented 1 year ago

@k1LoW I am pretty sure is related to the postgres version. If I load the same database in postgres 14 and run the tbls with the same configuration, it does work.