postgres select all not working [duplicate] - postgresql

This question already has an answer here:
Why can't I see the column names of a table?
(1 answer)
Closed 4 years ago.
I am trying to do a select all on my postgresql table with psql and I am getting a relation does not exist error even though when I run \dt the table clearly does exist. When I enter \d I get:
public | OwnershipDocument | table | iswdp
public | OwnershipDocument_id_seq | sequence | iswdp
When I enter:
select * from OwnershipDocument;
I get:
ERROR: relation "ownershipdocument" does not exist
LINE 1: select * from OwnershipDocument;
I have no idea why this is not working. This database was created with the Django ORM.

select * from "OwnershipDocument". You need quotes because of the uppercase characters.

Related

Getting an error on a Postgres table "ERROR: column does not exist" that doesn't make sense to me [duplicate]

This question already has answers here:
PostgreSQL "Column does not exist" but it actually does
(6 answers)
sql statement error: "column .. does not exist"
(1 answer)
PostgreSQL column 'foo' does not exist
(12 answers)
SQL query column does not exist error
(1 answer)
Closed 1 year ago.
In pgAdmin if I do a simple select:
"select * from NFT where item_id = 1271" I get what I would expect:
However, when I try to query on this other column: "select * from NFT where tokenID = 40" I get an error: "ERROR: column "tokenid" does not exist
I'm new to Postgres in the last year, have used it quite a bit but this one has me stuck on how to proceed. It's just a normal column.
any ideas?

What is the exact way of using where clause in PostgreSQL 12? [duplicate]

This question already has answers here:
PostgreSQL "Column does not exist" but it actually does
(6 answers)
sql statement error: "column .. does not exist"
(1 answer)
Postgres column does not exist
(1 answer)
Closed 1 year ago.
I am trying to query a table using where clause in Postgres 12
case 1
SELECT *
FROM schema.e_employee_table
WHERE FK_EMPLOYEE=100;
so when i query the above query i get "FK_EMPLOYEE" column is missing.
case2:
SELECT *
FROM schema.e_employee_table
WHERE "FK_EMPLOYEE"=100;
when i query the above one i got the query results
So can someone explain do we need to put our column name inside "",is it the syntax. If so where it is mentioned in the official documentation.
And I can also see the column name we are mentioning is case sensitive.

I have created a PostgreSQL table but I can't SELECT if I use the WHERE parameter [duplicate]

This question already has answers here:
delete "column does not exist"
(1 answer)
SQL domain ERROR: column does not exist, setting default
(3 answers)
Simple Postgresql Statement - column name does not exists
(2 answers)
Closed 2 years ago.
I am really new at coding in general.
I have created a table but when I try to use SELECT * FROM users WHERE (username = "adminis"); I get ERROR: column "adminis" does not exist. What I am trying to do is to find the user 'adminis' and get the other columns. I have also gone to the documentation but it really does not say a lot.
The table in question:
user_id | username | email | password
---------+----------+-----------------+-----------
1 | adminis | admin#admin.com | ********
Thank you
Double quotes are used for delimiting entity names (if needed), for example:
select *
from "my silly table name with spaces"
Single quotes are used to delimit text. Using your case as an example:
select *
from users
where username = 'adminis'

How can I query in psql. If column name like camelCase [duplicate]

This question already has answers here:
Are PostgreSQL column names case-sensitive?
(5 answers)
Closed 5 years ago.
My psql table structure like below:
id userName gender
1 xxxx Male
if I am using query like below from psql shell:
select * from table where userName="xxx";
It gives error:
Error: column "userName" does not exists.
How can I query if column name contain with camelCase.
All identifiers are converted to lower case in postgres. To use upper case identifiers you should use double quotes around identifier to say postgres to not convert it to lower case :
select * from table where "userName" = 'xxx';

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

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:
What is wrong here?
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.
When using the psql console in cmd, sometimes you may forget to add ';' at the end of select statement
Example -1: select * from user #does not give any result back
select * from user; #this works with ';' at the end
Don't take me wrong I faced this issue in Postgresql version 13
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)