postgresql, duplicate database which is a replication of another I have original DB-original
and have a streaming-replication DB-replica

I want a writable copy of DB-replica and did

createdb -T DB-replica DB-copy-of-replica


  createdb: database creation failed: ERROR:  cannot execute CREATE
  DATABASE in a read-only transaction


How do I copy the DB?
It looks like you have a physical standby/replica. In physical standby, you cannot have a writeable copy of any database. If you want a writable copy of the database, you can follow either of the following:


Create a new cluster postgreSQL and export the database from a READ replica (physical standby) using pg_dump and pg_restore. (Refer the pg_dump/pg_restore command from PostgreSQL document)
You can use logical replication from the master
https://www.enterprisedb.com/postgres-tutorials/logical-replication-postgresql-explained