Re: SQL statement form shell ?

From: Scott Whitney <scott(at)journyx(dot)com>
To: czezz <czezz(at)o2(dot)pl>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: SQL statement form shell ?
Date: 2014-08-27 15:30:03
Message-ID: 1040409514.1017500.1409153403592.JavaMail.zimbra@mail.int.journyx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

There are a few things I would check.

a) psql -p 5472 -d fm_db_Server4
b) 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&b succeed, but step d fails?

d) psql -p 5472 -d fm_db_Server4
e) 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\" ; "

----- Original Message -----

> 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(at)postgresql(dot)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 at http://go.journyx.com/emailPreference/e/4932/714

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Raghavendra 2014-08-27 16:43:11 Re: SQL statement form shell ?
Previous Message czezz 2014-08-27 15:23:08 Re: SQL statement form shell ?