News for hackers. Stuff that matters.
Re:Zero-downtime schema migrations in Postgres using views by ftc on Thursday June 17, 2021 @03:12AM (#27536924)
You probably already know this, but in case you don't a workaround for views not respecting RLS is to use an SQL function and then create a view which selects the fields from the function. Definitely more awkward than creating a view from a table without RLS though.

  CREATE OR REPLACE FUNCTION my_view() RETURNS TABLE (...columns) AS $$
    SELECT ...;
  $$ LANGUAGE SQL STABLE;

  CREATE OR REPLACE VIEW my_view AS SELECT * FROM my_view();

There are no comments on this comment yet.