Bruce Momjian <pgman@candle.pha.pa.us> writes:
> So template1 is writable (yuck) only so databases created from template1
> are writeable to world by default. Is that accurate?
Yup.
I had a probably-harebrained idea about this: the writeability of public
is only a serious issue when it is the default creation-target schema.
It's likely that you'd say "create table foo" without reflecting about
the fact that you're connected to template1; much less likely that you'd
say "create table public.foo". So, what if the default per-database GUC
settings for template1 include setting the search_path to empty? That
would preclude accidental table creation in template1's public schema.
As long as CREATE DATABASE doesn't copy the per-database GUC settings of
the template database, copied databases wouldn't be similarly crippled.
Now I'm not entirely convinced that CREATE DATABASE shouldn't copy the
per-database GUC settings of the template. But at the moment it
doesn't, and if we're willing to institutionalize that behavior then
it'd provide a way out.
Or is that too weird?
regards, tom lane