PostgreSQL Error I have not seen before

Hello all,

When I use the quiere below, I get a “relation hours does not exist”

ERROR:  relation "hours" does not exist
LINE 1: ...e_name,grace_period,start_time,stop_time,sid FROM hours WHER...                                                           
SELECT numeric_dow,dow,zone,zone_name,grace_period,start_time,stop_time,sid FROM hours WHERE ( hours.sid = '1000' ) ORDER BY hours.zone;

However, if I run the same quiere using PgAdmin 4, it works fine. Any ideas what the problem may be?

Thanks,
Tim

Try “hours”
something like:

SELECT numeric_dow,dow,zone,zone_name,grace_period,start_time,stop_time,sid FROM "hours" WHERE ( sid = '1000' ) ORDER BY zone;

or maybe zone is a reserved word?

Or the table was created like ‘Hours’?


Edit: usually I always work with tables in lowercase. Creating a table ‘Hours’ I get this with Valentina:
image

this doesn’t work either:
image

this works:
image

this works too:
image

Hi AlbertoD

my database tables and columns are all lower case.
Following your post, I did try and add quotation marks around the hours table but that resulted in the same thing…

However, after pulling hair and taking a break I found the problem. I was using the wrong “owner” as in session. In thhis case, Sesson. is not valid

Thanks for the insight
Tim

Not trying to be difficult here, but the error

ERROR: relation “hours” does not exist

could not possibly have been caused by you using the wrong owner. Postgres is usually quite clear in its error messages.

1 Like

He seems taking about a wrong schema (not exactly owner, but confuses some people), like querying in the “public” schema but the “hours” table was in another one needing being explicit lke system2.hours. Any table “not visible” will behave as “does not exist”.

It was the wrong ‘owner’ of the objects in Xojo. Nothing at all to do with Postgres - in my case.

But that you all for offering your ideas!

Tim