Re: ERROR: relation "default_cols" does not exist - Mailing list pgsql-novice

From John DeSoi
Subject Re: ERROR: relation "default_cols" does not exist
Date
Msg-id 9d11aa7220e217324fe89e8e0485720c@pgedit.com
Whole thread Raw
In response to Re: ERROR: relation "default_cols" does not exist  ("David Sadler" <david@dicapp.com>)
List 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


pgsql-novice by date:

Previous
From: "David Sadler"
Date:
Subject: Re: ERROR: relation "default_cols" does not exist
Next
From: Volkan YAZICI
Date:
Subject: Re: Carriage Returns Disappearing