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

cannot save query with LIKE operator #865

Closed
azimut opened this issue Apr 3, 2018 · 2 comments
Closed

cannot save query with LIKE operator #865

azimut opened this issue Apr 3, 2018 · 2 comments

Comments

@azimut
Copy link

azimut commented Apr 3, 2018

Description

I want to save a simple query that uses a LIKE operator. I can save it. But at call it returns "Bad arguments". I assume is trying to interpret the % on the query as parameters. But that is not what I want.

user@192.168.1.3:mydb> \ns a SELECT * from events WHERE description LIKE '%http%';
Time: 0.003s
user@192.168.1.3:mydb> \n a
Bad arguments

Your environment

  • Installed through pip
  • Python 2.7
  • Gentoo
  • pgcli==1.9.0
@judalabs
Copy link

Try this:

\ns a SELECT * from events WHERE description LIKE CONCAT('%%', 'http', '%%');

NOTE: The double percent is used to escaping

jrib pushed a commit to jrib/pgspecial that referenced this issue May 15, 2018
Users can already use parameters with "$N".  This makes it so that users
do not need to escape "%" with "%%" when using named queries.

See dbcli/pgcli#865.
jrib pushed a commit to jrib/pgspecial that referenced this issue May 15, 2018
Users can already use parameters with "$N".  This makes it so that users
do not need to escape "%" with "%%" when using named queries.

See dbcli/pgcli#865.
@amjith
Copy link
Member

amjith commented Nov 19, 2018

This issue has been fixed a while back. Can you try upgrading pgcli?

pip install -U pgcli

@amjith amjith closed this as completed Nov 19, 2018
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

3 participants