pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: czezz <czezz@o2.pl>
To: Scott Whitney <swhitney@journyx.com>
To: Scott Whitney <scott@journyx.com>
Cc: pgsql-admin@postgresql.org
Cc: raghavendra.rao@enterprisedb.com
Cc: payal@omniti.co
Subject: Re:  SQL statement form shell ?
Date: Thu, 28 Aug 2014 10:19:41 +0200
Message-ID: <6bc90f73.12c57c82.53fee61d.853f@o2.pl> (raw)
In-Reply-To: <1040409514.1017500.1409153403592.JavaMail.zimbra@mail.int.journyx.com>
References: <50235644.468fa51b.53fdf382.a46b@o2.pl>
	<1040409514.1017500.1409153403592.JavaMail.zimbra@mail.int.journyx.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-admin>

Hi,
I think I got it.
It seems that I need to indicate specific user name and only then the query works.
-bash-4.1$ psql -p 5472 -d fm_db_Server4 -U msuper -c "SELECT * FROM foo2;"
Im new to postgresql but I guess -U (user) also somehow defines tablespace where specific table is created.
Anyway, thank you all for your help and answers.
Cheers,
czezz
Dnia 27 sierpnia 2014 17:30 Scott Whitney &lt;scott@journyx.com&gt; napisał(a):
There are a few things I would check. a) psql -p 5472 -d fm_db_Server4b) SELECT * from foo2;c) Do those _2_ statements work separately? That should prove that you're talking to the exact same connection/host/port you expect.d) psql -p 5472 -d fm_db_Server4 -c "SELECT * FROM foo2; So, step a&amp;b succeed, but step d fails? d) psql -p 5472 -d fm_db_Server4e) SELECT * from "foo2";
 If this doesn't work, "foo2," is not a valid relation. It's case-sensitive or some such. Once you can make the table name work within " " marks, THEN try from the command prompt like: f) psql -p 5472 -d fm_db_Server4 -c "SELECT * FROM \"foo2\" ; "  Im trying to execute simple query in shell.
This query works OK in PSQL client:
Server4=# SELECT * FROM foo2;
 However, for some reason I cannot execute it in shell. I try it like following:
 -bash-4.1$ psql -p 5472 -d fm_db_Server4 -c "SELECT * FROM foo2;"
ERROR:  relation "foo2" does not exist
LINE 1: SELECT * FROM foo2;
                      ^
 Any ideas what Im doing wrong ?
 BR,
czezz
 
--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin 
 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. 

view thread (7+ messages)

Message-ID: <6bc90f73.12c57c82.53fee61d.853f@o2.pl>
Permalink:  ../6bc90f73.12c57c82.53fee61d.853f@o2.pl/
Also on:    postgresql.org/message-id/6bc90f73.12c57c82.53fee61d.853f@o2.pl

 · 

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-admin@postgresql.org
  Cc: czezz@o2.pl, swhitney@journyx.com, scott@journyx.com, raghavendra.rao@enterprisedb.com, payal@omniti.co
  Subject: Re:  SQL statement form shell ?
  In-Reply-To: <6bc90f73.12c57c82.53fee61d.853f@o2.pl>

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

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