On Thu, 2011-07-07 at 20:56 -0700, Darren Duncan wrote:
> > When you create a temporary table, PostgreSQL needs to add rows in
> > pg_class, pg_attribute, and probably other system catalogs. So there are
> > writes, which aren't possible in a read-only transaction. Hence the
> > error. And no, there is no workaround.
>
> That sounds like a deficiency to overcome.
>
> It should be possible for those system catalogs to be virtual, defined like
> union views over similar immutable tables for the read-only database plus
> mutable in-memory ones for the temporary tables.
Ideally, yes, from a logical standpoint there are catalog entries that
are only interesting to one backend.
But that doesn't mean it's easy to do. Remember that catalog lookups
(even though most go through a cache) are a path that is important to
performance. Also, more complex catalog interpretations may introduce
some extra bootstrapping challenges.
> Are there any plans in the works to do this?
I don't think so. It sounds like some fairly major work for a
comparatively minor benefit.
Suggestions welcome, of course, to either make the work look more minor
or the benefits look more major ;)
Regards,
Jeff Davis