0

I have been using SQL for many years, but I am pretty new to postgresql. I'm using pgAdmin and I'm running the following query just fine.

select *
from budget_spending
where market is not null
limit 10

However, this query does NOT run.

select *
from budget_spending
where Project_Description is not null
limit 10

I get this error message:

ERROR:  column "project_description" does not exist

This is very bizarre, because I'm looking at it and it certainly does exist. If I right-click the column and go to Properties, I see 'Project_Description' as the name of the column. What am I missing here?

ASH
  • 20,759
  • 19
  • 87
  • 200
  • Maybe it's a security issue. Is it possible that the column is locked, or I don't have permissions to run that kind of a query? I'm coming here from a SQL Server background. I've never seen that kind of security on SQL Server. – ASH May 04 '21 at 15:31
  • As it turns out, I had to put double quotes around the offensive column name. That seems a little weird, when there is no space in the column name. Oh well. Now I know. – ASH May 04 '21 at 16:18
  • 1
    Unless column names are double quoted Postgres converts then to lower case (as opposed to the SQL standard which specifies upper case). It seems who ever defined the table wanted to maintain the capitalization in the name. But once created with double quotes all references must also use double quotes. – Belayer May 04 '21 at 21:49
  • Thanks for the info!! Really appreciate it!!!! – ASH May 05 '21 at 02:34

0 Answers0