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

Error parse DSN in postgres if the password has '#' character #429

Open
vivacarvajalito opened this issue Feb 2, 2023 · 1 comment
Open
Assignees
Labels
bug Something isn't working

Comments

@vivacarvajalito
Copy link

What happened

If the password contains the character '#', the parse don't work

What you expected to happened

Connect to database

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

parse "pg://postgres:passw": invalid port ":passw" after host

github.com/k1LoW/tbls/datasource.Analyze
	/Users/runner/work/tbls/tbls/datasource/datasource.go:57

Anything else we need to know?

Environment

  • tbls version 1.60.0
  • Database version postgres 12
  • OS ( Ubuntu bionic, macOS Calalina, WSL2, etc ) macOS Ventura
  • Shell ( bash, zsh, poworshell, etc ) zsh
  • Stacktrace or error message from tbls ( If you can, set DEBUG=1)
parse "pg://postgres:passw": invalid port ":passw" after host
github.com/k1LoW/tbls/datasource.Analyze
	/Users/runner/work/tbls/tbls/datasource/datasource.go:57
github.com/k1LoW/tbls/cmd.glob..func7
	/Users/runner/work/tbls/tbls/cmd/out.go:77
github.com/spf13/cobra.(*Command).execute
	/Users/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:916
github.com/spf13/cobra.(*Command).ExecuteC
	/Users/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1044
github.com/spf13/cobra.(*Command).Execute
	/Users/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:968
github.com/k1LoW/tbls/cmd.Execute
	/Users/runner/work/tbls/tbls/cmd/root.go:191
main.main
	/Users/runner/work/tbls/tbls/main.go:34
runtime.main
	/usr/local/Cellar/go/1.19.5/libexec/src/runtime/proc.go:250
runtime.goexit
	/usr/local/Cellar/go/1.19.5/libexec/src/runtime/asm_amd64.s:1594
  • Config ( .tbls.yml )
# DSN (Database Source Name) to connect database
dsn: pg://postgres:passw#rd@localhost:5432/test_db
@vivacarvajalito vivacarvajalito added the bug Something isn't working label Feb 2, 2023
@k1LoW
Copy link
Owner

k1LoW commented Feb 2, 2023

# is the syntax for YAML comments and is not a valid URL.

You might want to surround the DSN with a single quart and urlencode.

dsn: 'pg://postgres:passw%23rd@localhost:5432/test_db'

@k1LoW k1LoW self-assigned this Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants