Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8132909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:27:34+00:00 2026-06-06T09:27:34+00:00

I want to create a read-only user in PostgreSQL. The intention is to have

  • 0

I want to create a read-only user in PostgreSQL.

The intention is to have a publicly accessible data explorer, where users can write custom SQL queries.

I do this to create the user:

CREATE USER MyReadOnlyUser WITH ENCRYPTED PASSWORD 'MY_WEAK_PASSWORD';

GRANT ALL PRIVILEGES ON DATABASE "MY_DB_NAME" to MyReadOnlyUser;

GRANT ALL ON SCHEMA public TO MyReadOnlyUser; 
GRANT SELECT ON ALL TABLES IN SCHEMA public TO MyReadOnlyUser; 

The intention is to give the user SELECT access to all tables, then revoke select access on the sensitive tables, and then the user can run custom queries with that db user, without any need for me to sanitize input.

Especially, he may not:

insert, delete, truncate, drop table, drop database, create table, create function/procedure, see/execute/create/drop stored procedure / functions. etc.

Sooo – now my question:
Why does this user have access to information_schema ?
It wasn’t granted access to any views, and not to the schema information_schema either…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T09:27:36+00:00Added an answer on June 6, 2026 at 9:27 am

    Why does this user have access to information_schema

    I think select privilege is granted to PUBLIC by default on information_schema.

    You should be able to do:

    revoke all on all tables in schema information_schema from public;
    

    You probably also need to revoke the select privilege on views/tables in the pg_catalog schema. But I’m not sure what this will break if e.g. psql or other client tools cannot access that information.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My iPhone app will have read-only system data AND read/write user data (stored either
I want to create a postgres user that can access only one database on
I want to create two users on my MySQL test database, One with read-only
I have made an interface whereby the user can create his own form. I've
sorry for my language - in English i can only read :) i want
I have read-only access to the trunk of a SVN repository and I want
I want to create a simple logfile in PHP that later can be read
I want to create a cookie using php,an also i need to read it
I want to create a list of GridBagPanel.Constraints . I read it in the
i'm having problem when i want to create mobile optimization in my site,i'm read

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.