Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

postgres - select * from existing table - psql says table does not exist

Tags:

postgresql

Fresh postgres installation, db 'test', table 'Graeber' created from another program.

I want to see the content of table 'Graeber'. When I connect to the database and try to select the content of 'Graeber', the application tells me : ERROR: relation "graeber" does not exist.

See screenshot:

enter image description here

What is wrong here?

like image 472
Lokomotywa Avatar asked Jan 30 '15 16:01

Lokomotywa


People also ask

How do I fetch a table in PostgreSQL?

If you want to select data from all the columns of the table, you can use an asterisk ( * ) shorthand instead of specifying all the column names. The select list may also contain expressions or literal values. Second, specify the name of the table from which you want to query data after the FROM keyword.

How do I force drop a table in PostgreSQL?

PostgreSQL has a DROP TABLE statement that is used to remove an existing table or tables from the database. Syntax: DROP TABLE [IF EXISTS] table_name [CASCADE | RESTRICT];

What is the wildcard in PostgreSQL?

Wildcards in PostgreSQL is used to find matching rows values from tables; it is also used to find matching patterns rows from tables, Wildcards is also used to find matching rows, column and tables names; the output of the wildcard operator will return matching name, which was table name, column name or rows, In ...


2 Answers

Try adding the schema as in:

select *
from public.Graeber

If that doesn't work, then it is because you have a capital letter so try:

select *
from public."Graeber"

Hope this helps.

like image 156
Walker Farrow Avatar answered Sep 21 '22 06:09

Walker Farrow


See This Example.

queuerecords=# create table employee(id int,name varchar(100));
        CREATE TABLE


queuerecords=# insert into employee values(1,'UsmanYaqoob');
        INSERT 0 1


queuerecords=# select * from employee;
    id |    name
    ----+-------------
    1 | UsmanYaqoob
    (1 row)
like image 24
Usman Yaqoob Avatar answered Sep 19 '22 06:09

Usman Yaqoob