Обсуждение: Extensions in schemas
Is there any particular reason why we can't/don't auto-create schema bar when you run "CREATE EXTENSION foo SCHEMA bar"? -- Magnus Hagander Me: http://www.hagander.net/ Work: http://www.redpill-linpro.com/
On Mon, May 16, 2011 at 3:59 AM, Magnus Hagander <magnus@hagander.net> wrote: > Is there any particular reason why we can't/don't auto-create schema > bar when you run "CREATE EXTENSION foo SCHEMA bar"? OK, I'll ask the obvious question. Should we also auto-create the schema when a user says CREATE TABLE bar.foo()? If not, how is this different? (You knew that was coming.) -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Magnus Hagander <magnus@hagander.net> writes: > Is there any particular reason why we can't/don't auto-create schema > bar when you run "CREATE EXTENSION foo SCHEMA bar"? That was considered, and rejected for reasons that I probably don't recall all of, but I do remember one argument: 99.44% of the time you want an extension to be in a schema that has public USAGE rights. Having the CREATE EXTENSION command auto-create the schema would be of little value unless it also auto-granted that right, and that didn't seem like a good idea. regards, tom lane
Magnus Hagander <magnus@hagander.net> writes: > Is there any particular reason why we can't/don't auto-create schema > bar when you run "CREATE EXTENSION foo SCHEMA bar"? We do it when the schema is given in the control file. I'm not sure off hand but we maybe only do that when the extension is *not* relocatable. The idea is that if you're asking for an extension to live in a given schema, it must already exists, whereas if the extension's author is the one who says which schema it must live in, then the system is kind enough to make that happen (and mark the schema as being part of the extension, I think). Yeah, I forgot to git pull on this laptop I bring with me at conferences, so I can't read the sources to tell you for sure. Expect me to fix that after landing :) -- Dimitri Fontaine http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support