2

I am enabling Row level security on a table. I want the row security only on SELECT. So that other users can insert and update their respective records. I am using postgreSQL and I am pretty much beginner for 'ROW-LEVEL-SECURITY'. I am trying it with following commands. Please update if I am mixing PSQL and MySQL commands. or any better way to achieve it.

ALTER TABLE important_table ENABLE ROW LEVEL SECURITY;

It works fine but then when I specify for select,

ALTER TABLE important_table SET ROW SECURITY FOR SELECT;

I get error with it:

Error: syntax error at or near "ROW"
sticky bit
  • 36,626
  • 12
  • 31
  • 42
khaldi
  • 472
  • 7
  • 15

1 Answers1

1

As mentioned by Laurenz Albe, we have to create Policy for required privileges like For and Update. Once Policy is created, Row level security will work for mentioned previledges.

khaldi
  • 472
  • 7
  • 15
  • Hi. This is a comment, and not an answer. :-) Can you copy the text to your question and delete this "answer"? Regards – kometen Jul 24 '18 at 19:14
  • @kometen.. than how can I accept the answer and mark the question solved? do you recommend me deleting it anyways? – khaldi Jul 25 '18 at 07:47
  • Aah, I may have misunderstood your answer to your own question as a comment. If this solves your problem you can leave it as it is. Regards – kometen Jul 25 '18 at 08:31