Thread: bug with psql 8.3.3 on ubuntu

bug with psql 8.3.3 on ubuntu

From
Viraj Kanwade
Date:
Hi,

I have a table which has capital characters in it.

I am running the command

psql -d mydb -U usr -t -c " select val1 from ""MyTable"" where val2 =
'abc' "
OR
psql -d mydb -U usr -t -c ' select val1 from "MyTable" where val2 =
''abc'' '

Both work fine on my windows machine.

But when I try to run these commands on Ubuntu, I get the escaped (")/
(') are ignored.

The command it is interpreting is

psql -d mydb -U usr -t -c " select val1 from MyTable where val2 = 'abc' "
OR
psql -d mydb -U usr -t -c ' select val1 from "MyTable" where val2 = abc '

Hence, it wont work for me.

Why is this different behavior?

Please let me know what I should be doing to make it work on Ubuntu.

Thanks.
Regards,
Viraj

Re: bug with psql 8.3.3 on ubuntu

From
toruvinn
Date:
On Thu, 23 Oct 2008 18:46:34 +0200, Viraj Kanwade <virajk@gslab.com> wrote:
> psql -d mydb -U usr -t -c " select val1 from ""MyTable"" where val2 =
> 'abc' "
> OR
> psql -d mydb -U usr -t -c ' select val1 from "MyTable" where val2 =
> ''abc'' '
>
> Both work fine on my windows machine.
This is completely not PostgreSQL related.
That's shell scripting/escaping problem.

Try that:
psql -d mydb -U usr -t -c 'select val1 from "MyTable" where val2 =
'"'"'abc'"'" (eww)
or
psql -d mydb -U usr -t -c "select val1 from \"MyTable\" where val2 =
'abc'" (seems better)


--
ru