HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlMinor

Create temp tables in Amazon RDS PostgreSQL read-replica

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
postgresqltablescreatereadreplicatempamazonrds

Problem

I have dozens of legacy stored procedures which create temporary tables inside for collecting results for a read-only application.

I've created a read-replica of my PostgreSQL in Amazon RDS and tried to perform this procedures, but failed, as it doesn't allow to create even temporary tables in a read-only transaction.

Are any ways how to solve this issue with minimal efforts?

Solution

As the most easy way which I found to solve this issue - is wrapping all "temporary tables" into separate stored procedures, which return TABLE(...) type, and then use Common Table Expressions (https://www.postgresql.org/docs/9.1/static/queries-with.html).

Context

StackExchange Database Administrators Q#152228, answer score: 3

Revisions (0)

No revisions yet.