[Bug]: Does not pull FK depending on rights in postgre
An open-source desktop client for modern databases.
Status: Beta
Brought to you by:
debba92
Originally created by: Mazwak
I have a Postgre DB with a read-only user for most queries.
If I open it with this user, I don’t see the FK.
If I open it with postgre, I see them.
Connect to postgre with a realonly user.
User setup with:
GRANT USAGE ON SCHEMA your_schema TO readonly_user;
GRANT SELECT ON ALL TABLES IN SCHEMA your_schema TO readonly_user;
Open schema with tabularis, no FK are showed.
Windows 10
0.9.9
Originally posted by: Mazwak
Your query is (from mitm):
SELECT c.column_name, c.data_type, c.is_nullable, c.column_default, c.is_identity, c.character_maximum_length, (SELECT COUNT(*) FROM information_schema.table_constraints tc JOIN information_schema.key_column_usage kcu ON tc.constraint_name = kcu.constraint_name AND tc.table_schema = kcu.table_schema WHERE tc.constraint_type = 'PRIMARY KEY' AND tc.table_schema = c.table_schema AND kcu.table_name = c.table_name AND kcu.column_name = c.column_name) > 0 as is_pk FROM information_schema.columns c WHERE c.table_schema = $1 AND c.table_name = $2 ORDER BY c.ordinal_position
But I have 0 rows in information_schema.table_constraints with the read-only user.
I don’t know why.
But I do have access to pg_constraint (and some other tables), so the following does work:
I tried to see how dbeaver handles it, but failed.