Skip to content

Adding a new table to the replication server

Mike Lissner edited this page Dec 22, 2023 · 1 revision

There are a couple things to think about while adding a new table to make it available across all replicas.

Get it from prod to cl-replica

The subscription (publication?) on the replica is for all tables and the user that subscribes is the django user, so all you have to do is go to the subscriber (replica), and do:

alter subscription from_prod_to_replica2 refresh publication;

Get it to the user databases

These only subscribe to certain tables and only have access to certain tables. To add a table to them:

  1. Tweak the publication on our server:

     alter publication opendata_clientname add table only xyz, abc;
    
  2. Allow the user select access on the table (note that this must be done as the postgres user!):

      GRANT SELECT on table xyz, abc to some-user ;
    

    You can get the name of the users with: SELECT rolname FROM pg_roles;

  3. Refresh the publication on the subscriber:

    ALTER SUBSCRIPTION some-subscription REFRESH PUBLICATION;
    

References

https://github.com/freelawproject/courtlistener/issues/1561