k1LoW / tbls

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

Doesn't work for RedShift #370

Closed snicmakino closed 1 year ago

snicmakino commented 1 year ago

What happened

When I run tbls for Redshift, I get the following error
pq: function pg_get_function_arguments(oid) does not exist

What you expected to happened

tbls tried to use a function that does not exist in RedShift(PostgreSQL8.0.2)

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

pq: function pg_get_function_arguments(oid) does not exist

Anything else we need to know?

Redshift is based on postgreSQL8.0.2 and the function was added in PostgreSQL 8.4.

Environment

bash-4.2# export DEBUG=1
bash-4.2# tbls doc
pq: function pg_get_function_arguments(oid) does not exist
github.com/k1LoW/tbls/drivers/postgres.(*Postgres).getFunctionsByQuery
        /home/runner/work/tbls/tbls/drivers/postgres/postgres.go:442
github.com/k1LoW/tbls/drivers/postgres.(*Postgres).getFunctions
        /home/runner/work/tbls/tbls/drivers/postgres/postgres.go:430
github.com/k1LoW/tbls/drivers/postgres.(*Postgres).Analyze
        /home/runner/work/tbls/tbls/drivers/postgres/postgres.go:300
github.com/k1LoW/tbls/datasource.Analyze
        /home/runner/work/tbls/tbls/datasource/datasource.go:118
github.com/k1LoW/tbls/cmd.glob..func5
        /home/runner/work/tbls/tbls/cmd/doc.go:70
github.com/spf13/cobra.(*Command).execute
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:856
github.com/spf13/cobra.(*Command).ExecuteC
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:974
github.com/spf13/cobra.(*Command).Execute
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:902
github.com/k1LoW/tbls/cmd.Execute
        /home/runner/work/tbls/tbls/cmd/root.go:180
main.main
        /home/runner/work/tbls/tbls/main.go:34
runtime.main
        /opt/hostedtoolcache/go/1.18.5/x64/src/runtime/proc.go:250
runtime.goexit
        /opt/hostedtoolcache/go/1.18.5/x64/src/runtime/asm_amd64.s:1571
github.com/k1LoW/tbls/drivers/postgres.(*Postgres).getFunctions
        /home/runner/work/tbls/tbls/drivers/postgres/postgres.go:432
github.com/k1LoW/tbls/drivers/postgres.(*Postgres).Analyze
        /home/runner/work/tbls/tbls/drivers/postgres/postgres.go:300
github.com/k1LoW/tbls/datasource.Analyze
        /home/runner/work/tbls/tbls/datasource/datasource.go:118
github.com/k1LoW/tbls/cmd.glob..func5
        /home/runner/work/tbls/tbls/cmd/doc.go:70
github.com/spf13/cobra.(*Command).execute
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:856
github.com/spf13/cobra.(*Command).ExecuteC
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:974
github.com/spf13/cobra.(*Command).Execute
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:902
github.com/k1LoW/tbls/cmd.Execute
        /home/runner/work/tbls/tbls/cmd/root.go:180
main.main
        /home/runner/work/tbls/tbls/main.go:34
runtime.main
        /opt/hostedtoolcache/go/1.18.5/x64/src/runtime/proc.go:250
runtime.goexit
        /opt/hostedtoolcache/go/1.18.5/x64/src/runtime/asm_amd64.s:1571
dsn: "redshift://${REDSHIFT_USER}:${REDSHIFT_PASS}@${REDSHIFT_HOST}:5439/${REDSHIFT_DB_NAME}"
docPath: docs
name: test
format:
  adjust: true
  number: true
include:
  - ${REDSHIFT_SCHEMA}.*
exclude:
  - ${REDSHIFT_SCHEMA}.v_*
er:
  skip: false
  format: svg
  comment: true
k1LoW commented 1 year ago

Fixed in v1.56.3 for Amazon RedShift to skip function getting. Can you try it?

snicmakino commented 1 year ago

@k1LoW It works, thank you for your rapid handle!