1

I have a Postgres database, and I connect to it via a rest webservice. However, I get an error saying:

Could not find relation 'mytablename'

I believe this is because I have used camel casing in my database and the tables are named like myTableName. Is there anyway I can disable case sensitivity in postgresql? Or would I have to (if this is possible) make my rest calls case sensitive?

toing_toing
  • 2,334
  • 1
  • 37
  • 79
  • So you are using an ORM that uses quotes for all identifiers? – wildplasser Aug 24 '16 at 09:15
  • Used the `entity classes from database` option in netbeans. – toing_toing Aug 24 '16 at 09:39
  • 1
    Simple answer: **never** use double quotes for identifiers. Details are in the manual: https://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS –  Aug 24 '16 at 10:21

1 Answers1

2

This answer started off as a comment but then evolved when I realized I might have an explanation for your problem.

All identifiers that are not double-quoted fall to lowercase in Postgres (q.v. here). So SELECT * FROM MYTABLENAME should behave identically to SELECT * FROM mytablename.

I think a likely cause of this is that Postgres is looking in the wrong schema for the mytablename table. Try this instead:

SELECT * FROM myschema.mytablename

where myschema is the name of the schema containing the mytablename table. If this doesn't fix the problem, you should make sure that the table actually exists.

Community
  • 1
  • 1
Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360