Quoted strings on CLI

From: Alexander Reichstadt <lxr(at)mac(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Quoted strings on CLI
Date: 2012-03-02 08:59:49
Message-ID: E9D61B45-37C0-4833-96C0-3025BFC08245@mac.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I just migrated from mysql and am running into an issue I found no solution for when researching. Using the web interface I can insert values that contain single-quotes. But using the CLI I found no way to select or insert single quotes:

PetWork=# select * from persons where firstname='\'Peter\'';
Invalid command \'';. Try \? for help.
PetWork-# select * from persons where firstname='\\'Peter\\'';
Invalid command \. Try \? for help.
PetWork-# select * from persons where firstname='\\\'Peter\\\'';
Invalid command \. Try \? for help.
PetWork-# select * from persons where firstname='\\\\'Peter\\\\'';
Invalid command \. Try \? for help.
PetWork-# select * from persons where firstname='\\\\'Peter\\\\'';

On different forums the solution suggested is to prepend backslashes. But it doesn't matter how many backslashes I prepend, it always fails. What does one have to do to achieve that?

Thanks for any help

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2012-03-02 09:14:22 Re: Quoted strings on CLI
Previous Message chinnaobi 2012-03-02 08:28:48 Re: archive_cleanup_command recovery.conf Standby server error