GithubHelp home page GithubHelp logo

'@' in password about pgcli HOT 9 CLOSED

dbcli avatar dbcli commented on July 27, 2024
'@' in password

from pgcli.

Comments (9)

jackmaney avatar jackmaney commented on July 27, 2024 2

Have you tried URL-escaping the @ to %40?

from pgcli.

amjith avatar amjith commented on July 27, 2024

That's most definitely a bug. I wonder how psql handles this.

In the meantime you can try using the command line switches to prompt for the password instead of using the postgres:// style url.

pgcli -h localhost -p 5432 -U amjith -W app_db

Launching that way will prompt for the password.

from pgcli.

drocco007 avatar drocco007 commented on July 27, 2024

Have you tried with the latest pgcli? I successfully connected using a role with an '@' character using pgcli 0.16.0 against a 9.4 server:

postgres=# create role atpw LOGIN PASSWORD '@at';
CREATE ROLE
postgres=# create database atdb owner atpw;
CREATE DATABASE
postgres=# \q

$ pgcli postgres://atpw:@at@localhost:5432/atdb
Version: 0.16.0
Chat: https://gitter.im/amjith/pgcli
Mail: https://groups.google.com/forum/#!forum/pgcli
Home: http://pgcli.com
atdb> 

from pgcli.

amjith avatar amjith commented on July 27, 2024

Previously I was using my own custom built parsing routine for extracting the password and username from the postgres url. I've replaced that routine with urlparse from python stdlib. So this might not be an issue anymore.

Thanks @drocco007 for testing it. I'll close the issue.

from pgcli.

catando avatar catando commented on July 27, 2024

The issue seems to persist/have returned:

pgcli postgres://atpw:@at@localhost:5432/atdb
could not translate host name "at@localhost" to address: nodename nor servname provided, or not known

A workaround is to escape the @s with sed:

pgcli postgres://atpw:"$(echo '@at'|sed -e s/@/\%40/g)"@localhost:5432/atdb

from pgcli.

j-bennet avatar j-bennet commented on July 27, 2024

@catando What is your pip freeze output?

from pgcli.

przdev avatar przdev commented on July 27, 2024

@timothyjlaurent

for @ in password you need to encode @ with %40 and quote whole uri
ex: pgcli 'postgresql://postgres:%40postgres@localhost:5432/postgres'
also with arguments use same
ex: pgcli -h localhost -U postgres -W '@postgres' -d postgres
tested it works

from pgcli.

przdev avatar przdev commented on July 27, 2024

@j-bennet @amjith above solution work, so you can close issue (if need to add it in readme than I'll happy to contribute)

from pgcli.

j-bennet avatar j-bennet commented on July 27, 2024

@przdev A note in readme would be good, or better yet, in the docs on the pgcli.com website. Here is the link to docs source:

https://github.com/dbcli/pgcli.com/blob/master/content/pages/3.docs.md

from pgcli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.