agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: srilinux <srilinux09@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Query is executing but giving error when using with shell scripting
Date: Thu, 14 Sep 2017 08:58:07 -0700 (MST)
Message-ID: <1505404687156-0.post@n3.nabble.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>

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



view thread (4+ messages)  latest in thread

Message-ID: <1505404687156-0.post@n3.nabble.com>
Permalink:  ../1505404687156-0.post@n3.nabble.com/
Also on:    postgresql.org/message-id/1505404687156-0.post@n3.nabble.com

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: srilinux09@gmail.com
  Subject: Re: Query is executing but giving error when using with shell scripting
  In-Reply-To: <1505404687156-0.post@n3.nabble.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox