X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 1E5B811F7A03 for ; Mon, 24 Apr 2006 14:37:38 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 42670-01-2 for ; Mon, 24 Apr 2006 14:36:58 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 379DF11F8EE4 for ; Mon, 24 Apr 2006 06:20:21 -0300 (ADT) Received: from ranger.systems.pipex.net (ranger.systems.pipex.net [62.241.162.32]) by svr4.postgresql.org (Postfix) with ESMTP id 6C5855AFBD6 for ; Mon, 24 Apr 2006 09:20:22 +0000 (GMT) Received: from flange.edesix.com (81-86-64-236.dsl.pipex.com [81.86.64.236]) by ranger.systems.pipex.net (Postfix) with ESMTP id 286D3E00015D for ; Mon, 24 Apr 2006 10:20:18 +0100 (BST) Received: from 81-178-2-11.dsl.pipex.com ([81.178.2.11] helo=[192.168.2.106]) by flange.edesix.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.50) id 1FXxEv-0007rT-Vz for pgsql-admin@postgresql.org; Mon, 24 Apr 2006 10:20:18 +0100 Message-ID: <444C9858.4050701@edesix.com> Date: Mon, 24 Apr 2006 10:20:24 +0100 From: Robin Iddon User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 Cc: pgsql-admin@postgresql.org Subject: Re: Problem with /usr/local/pgsql/bin/psql References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200604/236 X-Sequence-Number: 21405 Your problem here is quoting. You need to escape the quotes around the SQL strings so that the shell (I assume you're using Unix of some flavour) doesn't interpret them: /usr/local/pgsql/bin/psql -d temp -c 'insert into temp.ip_mapping_tb(ip,location) values(\'192.100.9.51\',\'FirstFloor\')' However, if I were you I would consider running via a file anyway - if you save your query into a file then you can use psql -d temp -f foo.sql instead. Within the file you can type your query exactly like it should be with no special escaping required. Hope this helps, Robin dhanesh.prabha@wipro.com wrote: > Hi , > > > I am trying to insert data into the table via shell script using > psql command. > But it giving syntax error. the same query is finely working pgAdmin > III client. > The query and error given below. > > > Eg: > > > ERROR: syntax error at or near ".9" at character 85 > LINE 1: ...pping_tb(ip,location) values(192.100.9.51,Firs... > > > Also when i am givinf Firstfloor as First Floor it was giving > error > > > /usr/local/pgsql/bin/psql -d temp -c 'insert into > temp.ip_mapping_tb(ip,location) values('192.100.9.51','First Floor')' > > > psql: FATAL: role "Floor)" does not exist > >