Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XMgR8-0001za-U6 for pgsql-admin@arkaria.postgresql.org; Wed, 27 Aug 2014 16:51:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XMgR8-0004US-6L for pgsql-admin@arkaria.postgresql.org; Wed, 27 Aug 2014 16:51:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XMgR7-0004UM-DO for pgsql-admin@postgresql.org; Wed, 27 Aug 2014 16:51:05 +0000 Received: from mail.journyx.com ([209.163.206.41] helo=mail.int.journyx.com) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XMgR1-0005pV-OP for pgsql-admin@postgresql.org; Wed, 27 Aug 2014 16:51:04 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.int.journyx.com (Postfix) with ESMTP id 4954C300275; Wed, 27 Aug 2014 11:50:58 -0500 (CDT) Received: from mail.int.journyx.com ([127.0.0.1]) by localhost (mail.int.journyx.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 2PozUiW9k7Nj; Wed, 27 Aug 2014 11:50:58 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by mail.int.journyx.com (Postfix) with ESMTP id 18DF231D1F0; Wed, 27 Aug 2014 11:50:58 -0500 (CDT) X-Amavis-Modified: Mail body modified (using disclaimer) - mail.int.journyx.com X-Virus-Scanned: amavisd-new at mail.int.journyx.com Received: from mail.int.journyx.com ([127.0.0.1]) by localhost (mail.int.journyx.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 60AS6rNK04iL; Wed, 27 Aug 2014 11:50:57 -0500 (CDT) Received: from mail.int.journyx.com (zimbra.int.journyx.com [192.168.100.5]) by mail.int.journyx.com (Postfix) with ESMTP id C89C5300275; Wed, 27 Aug 2014 11:50:57 -0500 (CDT) Date: Wed, 27 Aug 2014 11:50:57 -0500 (CDT) From: Scott Whitney Reply-To: Scott Whitney To: Raghavendra Cc: czezz , pgsql-admin Message-ID: <232963146.1020276.1409158257691.JavaMail.zimbra@mail.int.journyx.com> In-Reply-To: References: <50235644.468fa51b.53fdf382.a46b@o2.pl> <112eabb1.21891393.53fdf7dc.3a517@o2.pl> Subject: Re: SQL statement form shell ? MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1020275_1300105853.1409158257689" X-Mailer: Zimbra 8.0.7_GA_6021 (ZimbraWebClient - GC36 (Win)/8.0.7_GA_6021) Thread-Topic: SQL statement form shell ? Thread-Index: Stmi+h1JyI1N0+brf98gzGGeo50ciQ== X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org ------=_Part_1020275_1300105853.1409158257689 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Also, throughout this thread, you have given us 2 separate ports: 5472 and = 5432 (default).=20 In _this_ example, you set the database to "postgres," not to "Server4," as= well.=20 Then there's that whole "foo," versus "foo2," thing going on...=20 There are a lot of differences in what you have sent over the course of thi= s thread.=20 I would back up, take a deep breath, and start over.=20 1) Connect to your database something like this:=20 psql ___name of database___=20 2) SELECT * from "foo2";=20 3) Does that work? Once you make that work, proceed to test from the comman= d line like this:=20 psql ___name of database__ -c "SELECT * from \"foo2\" ; "=20 If you make 1 and 2 work, 3 should work. BUT ALL OF THE OPTIONS HAVE TO BE = THE SAME.=20 You cannot select * from foo in steps 1 and 2 and select * from foo2 in ste= p 3.=20 You cannot use port 5472 in step 1/2 and 5432 in step 3.=20 You cannot connect to the db postgres in steps 1/2 and another db in step 3= .=20 That invalidates your process.=20 ----- Original Message ----- > On Wed, Aug 27, 2014 at 8:53 PM, czezz < czezz@o2.pl > wrote: > > Copy/Paste error. DB name should be: fm_db_Server4 >=20 > =E2=80=8B > =E2=80=8BDid you set > PGOPTIONS environment variable for that terminal for any specific schema > which do not contain the table "foo" > =E2=80=8B. Then you might hit the error > -bash-4.1$ export PGOPTIONS=3D"-c search_path=3Dtester" > -bash-4.1$ psql -p 5432 -d postgres -c "SELECT * FROM foo;" > ERROR: relation "foo" does not exist > LINE 1: SELECT * FROM foo; > ^ > =E2=80=8B > =E2=80=8B--- > Regards, > Raghavendra > EnterpriseDB Corporation > Blog: http://raghavt.blogspot.com/ > > Dnia 27 sierpnia 2014 17:13 Raghavendra < raghavendra.rao@enterprisedb.= com > > > > > napisa=C5=82(a): >=20 > > > fm_db_Server4 > >=20 > Journyx, Inc.=0A7600 Burnet Road #300=0AAustin, TX 78757=0Awww.journyx.com=0A=0Ap 512.834.8888=0Af 512.834.8858=0ADo you receive our promotional emails? You can subscribe or unsubscribe to those emails at http://go.journyx.com/emailPreference/e/4932/714=0A ------=_Part_1020275_1300105853.1409158257689 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Also, throughout this thread, yo= u have given us 2 separate ports: 5472 and 5432 (default).

In _this_ example, you set the database to "postgres," not to "Ser= ver4," as well.
Then there's that whole "foo," versus "foo2," thi= ng going on...

There are a lot of differences in w= hat you have sent over the course of this thread.

= I would back up, take a deep breath, and start over.

1) Connect to your database something like this:
psql ___name = of database___

2) SELECT * from "foo2";
=
3) Does that work? Once you make that work, proceed to test = from the command line like this:

psql ___name of d= atabase__ -c "SELECT * from \"foo2\" ; "

If you ma= ke 1 and 2 work, 3 should work. BUT ALL OF THE OPTIONS HAVE TO BE THE SAME.=
You cannot select * from foo in steps 1 and 2 and select * from = foo2 in step 3.
You cannot use port 5472 in step 1/2 and 5432 in = step 3.
You cannot connect to the db postgres in steps 1/2 and an= other db in step 3.

That invalidates your process.=



On Wed, Aug 27, 2014 at 8:53 PM, czezz <czezz@o2= .pl> wrote:
Copy/Paste error. DB name should be: fm_db_Server4


=E2=80=8B
=E2=80=8BDid you set
PGOPTIONS environment variable for that terminal= for any specific schema which do not contain the table "foo"
=E2=80=8B. Then you might hit the error 

-b= ash-4.1$ export PGOPTIONS=3D"-c search_path=3Dtester"
-bash-4.1$ psql -p 5432 -d postgres -c "SELECT * FROM foo;"
ERROR:  relation "foo" does not exist
LINE 1: = SELECT * FROM foo;
          &nb= sp;           ^
=E2=80=8B
=E2=80=8B---
Regards,
Raghavendra
EnterpriseDB Corporation

 

Dnia 27 sierpnia 2014 17:13 Raghavendra <raghavendra.rao@enterprisedb.com= > napisa=C5=82(a):

fm_db_Server4





=


Journyx, Inc.
7600 Burnet Road #300
Austin, TX 78757
www.journyx.com

p 512.834.8888 
f 512-834-8858 

Do you receive our promotional emails? You can subscribe or unsubscribe to those emails here. 

=0A
= ------=_Part_1020275_1300105853.1409158257689--