Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dsWWr-0007Si-Qf for pgsql-sql@arkaria.postgresql.org; Thu, 14 Sep 2017 15:58:13 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dsWWr-0006u8-5S for pgsql-sql@arkaria.postgresql.org; Thu, 14 Sep 2017 15:58:13 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dsWWo-0006r0-RY for pgsql-sql@postgresql.org; Thu, 14 Sep 2017 15:58:11 +0000 Received: from n3.nabble.com ([162.255.23.22]) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dsWWm-00031D-80 for pgsql-sql@postgresql.org; Thu, 14 Sep 2017 15:58:09 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id 26D7B85FE8C0 for ; Thu, 14 Sep 2017 08:58:07 -0700 (MST) Date: Thu, 14 Sep 2017 08:58:07 -0700 (MST) From: srilinux To: pgsql-sql@postgresql.org Message-ID: <1505404687156-0.post@n3.nabble.com> Subject: Query is executing but giving error when using with shell scripting MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org Please suggest what is giving error here when I execute from psql prompt, I get the result, when I try to automate using a shell script, the query is not working # `/usr/bin/psql -U postgres -d coba1 -c "select name from users where "Date" > current_date - 30;"` ERROR: column "Date" does not exist LINE 1: select name from users where Date >current_... ======== works below ^ sudo -u postgres psql psql (9.4.5) Type "help" for help. postgres=# \connect coba1 You are now connected to database "coba1" as user "postgres". coba1=# select name from users where "Date" >current_date - 30; name --------------------- coba11 testCoba11 -- Sent from: http://www.postgresql-archive.org/PostgreSQL-sql-f2142323.html -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql