Re: ERROR: relation "default_cols" does not exist

From: John DeSoi <desoi(at)pgedit(dot)com>
To: "David Sadler" <david(at)dicapp(dot)com>
Cc: "pgsql-novice" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: ERROR: relation "default_cols" does not exist
Date: 2005-05-28 05:11:47
Message-ID: 9d11aa7220e217324fe89e8e0485720c@pgedit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


On May 28, 2005, at 2:15 PM, David Sadler wrote:

>
> dss: How do I logon directly to the test db using psql.exe without
> modifying
> its target path?
>
> js: One option is to navigate to the postgresql bin directory and then
> enter
> the psql command. Another is to add the bin directory to your PATH
> variable.
>
> John, is the psql.exe like sql*plus in oracle? Am I logging on to the
> server when it presents the password prompt, and then from there, I
> connect to whatever db I specify?
>

No, not quite. When you use psql, you must specify the database you
want to connect to. It is not a step after connecting. This might not
be apparent if you quickly glance at the documentation because it shows
that dbname and user name are optional parameters. But if you don't
supply a database name, it tries to connect to a database which matches
your account user name.

> ...
>
> dss: Why am I not able to select from the test db table I created?
> Instead, I get... ERROR: relation "default_cols" does not exist?
>
> js: Connect via psql and enter the command \dt to see a list of tables
> in the database. If it does not answer your question, show the output
> with the error and ask again.
>
> dss: Results of \dt against testdb "gov"...
>
> <<<
> List of relations
> Schema = public
> name = DEFAULT_COLS
> type = table
> owner = postgres
> (1 row)
>>>>
>
> dss: Result of select * from default_cols;

>
> <<<
> ERROR: relation "default_cols" does not exist
>>>>

PostgreSQL folds unquoted identifier names to lower case. If your table
listing shows the name in upper (or mixed) case, it likely means that
the table was named with quotes as in

CREATE TABLE "DEFAULT_COLS" ...

rather than

CREATE TABLE DEFAULT_COLS ...

So if it is named using double quotes, you will have to use that in
your commands:

select * from "DEFAULT_COLS";

See the ALTER TABLE command if you want to rename your table so you
don't have to use the double quotes.

John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Volkan YAZICI 2005-05-28 07:45:14 Re: Carriage Returns Disappearing
Previous Message Sadie D. Adams, V 2005-05-27 00:56:39 Industry News