0

I have question about PostgreSQL. I would like to return different results for select all based on the client IP and I want it on the database level. In other words, I want to change query string. Should I change the PostgreSQL code and compile it based on my idea?

1

In PostgreSQL 9.5 and newer you could use row-level security to do this. I don't think it's a great idea, but that's the way to approach it if you're going to attempt it.

  • Rules also come to mind to "change the query string". – a_horse_with_no_name Apr 10 '17 at 9:01
  • @a_horse_with_no_name Yeah, not sure how you'd apply that based on source IP though. Maybe with a WHERE condition on the rule. – Craig Ringer Apr 11 '17 at 1:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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