1

I created a schema with uppercase letters like this:

CREATE SCHEMA "requeteSQL"  AUTHORIZATION ......;

Now when I try to GRANT some privileges like :

GRANT SELECT ON ALL TABLES IN SCHEMA requetesql  TO ....;

I get the following error :

ERROR:  schema "requetesql" does not exist
2
  • 1
    Have you tried: GRANT SELECT ON ALL TABLES IN SCHEMA "requeteSQL" TO ....;
    – McNets
    Commented Jan 17, 2018 at 7:59
  • @McNets thanks a lot it works as you said GRANT SELECT ON ALL TABLES IN SCHEMA "requeteSQL" .... Commented Jan 17, 2018 at 8:01

1 Answer 1

5

Double quotes forces case sensitive names.

From this blog: Don’t use double quotes in PostgreSQL

Now, there is a way around this, namely by using double quotes. Whereas single quotes in PostgreSQL are used to create a text string, double quotes are used to name an identifier without changing its case.

Let me say that again, because so many people get this wrong: Single quotes and double quotes in PostgreSQL have completely different jobs, and return completely different data types. Single quotes return text strings. Double quotes return (if you can really think of them as “returning” anything) identifiers, but with the case preserved.

In your question you should change:

GRANT SELECT ON ALL TABLES IN SCHEMA requetesql  TO ....;

by

GRANT SELECT ON ALL TABLES IN SCHEMA "requeteSQL"  TO ....;
1
  • 2
    Or even better solution: Use only lowercase letters for all your Postgres identifiers. Use no double-quotes on your identifiers. This also makes your SQL more portable to other databases. Commented Jan 17, 2018 at 8:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.