Accessing referential constraint information with minimal permissions

From: Avin Kavish <avin(at)baseboard(dot)ai>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Accessing referential constraint information with minimal permissions
Date: 2023-06-24 12:35:45
Message-ID: CAN5h1oTXSiRGLWvdQff5V32YGjWLKzaAkW2mm80_iGMJcUMMbw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

I want to programmatically read all the references in a database. Ideally,
I want to do it with read-only permissions to the table. Is it possible?

I know the information is in `information_schema.referential_constraints`,
but apparently reading that information requires having write permissions
to the tables that have references. I don't know why it's designed like
that. I think knowing the relationships between tables is in the same class
of privileges as knowing the columns in the tables. (which you can do by
reading the `columns` view with just SELECT permissions)

Anyway, is there a workaround for this? If not, what is the least
destructive write permission I can give a user who wants this access?

Cheers,
Avin.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Christoph Moench-Tegeder 2023-06-24 12:56:39 Re: Accessing referential constraint information with minimal permissions
Previous Message John McKown 2023-06-24 03:02:06 Re: Why can't lseek the STDIN_FILENO?