0

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

closed as off-topic by hot2use, Jack Douglas Jan 17 '18 at 10:15

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Too localized - this could be because your code has a typo, basic error, or is not relevant to most of our audience. Consider revising your question so that it appeals to a broader audience. As it stands, the question is unlikely to help other users (regarding typo questions, see this meta question for background)." – hot2use, Jack Douglas
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Have you tried: GRANT SELECT ON ALL TABLES IN SCHEMA "requeteSQL" TO ....; – McNets Jan 17 '18 at 7:59
  • @McNets thanks a lot it works as you said GRANT SELECT ON ALL TABLES IN SCHEMA "requeteSQL" .... – BOUKANDOURA Mhamed Jan 17 '18 at 8:01
4

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
    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. – Basil Bourque Jan 17 '18 at 8:27

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