Обсуждение: 'pg_global' cannot be used as default_tablespace.

Поиск
Список
Период
Сортировка

'pg_global' cannot be used as default_tablespace.

От
PG Doc comments form
Дата:
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/13/bug-reporting.html
Description:

Tablespace 'pg_global' is one of the two auto-generated tablespace by
initdb, and 'pg_global' should not be used as the default_tablespace, since
it is used for shared system catalogs. However, none of these information is
recorded in the doc
https://www.postgresql.org/docs/11/runtime-config-client.html and
https://www.postgresql.org/docs/11/manage-ag-tablespaces.html. In case of
some mishandling to use 'pg_global' as a default_tablespace value, it is
better to record it in the doc of
https://www.postgresql.org/docs/11/manage-ag-tablespaces.html.

Re: 'pg_global' cannot be used as default_tablespace.

От
Bruce Momjian
Дата:
On Tue, Nov 10, 2020 at 08:28:08AM +0000, PG Doc comments form wrote:
> The following documentation comment has been logged on the website:
> 
> Page: https://www.postgresql.org/docs/13/bug-reporting.html
> Description:
> 
> Tablespace 'pg_global' is one of the two auto-generated tablespace by
> initdb, and 'pg_global' should not be used as the default_tablespace, since
> it is used for shared system catalogs. However, none of these information is
> recorded in the doc
> https://www.postgresql.org/docs/11/runtime-config-client.html and
> https://www.postgresql.org/docs/11/manage-ag-tablespaces.html. In case of
> some mishandling to use 'pg_global' as a default_tablespace value, it is
> better to record it in the doc of
> https://www.postgresql.org/docs/11/manage-ag-tablespaces.html.

I know this is three years old, but I am now looking at this email can
can't see the problem:

    SET default_tablespace = 'pg_global';

    CREATE TABLE test (x int);
    ERROR:  only shared relations can be placed in pg_global tablespace

Did you want an error from the SET command?

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Only you can decide what is important to you.



Re: 'pg_global' cannot be used as default_tablespace.

От
"David G. Johnston"
Дата:
On Wednesday, November 1, 2023, Bruce Momjian <bruce@momjian.us> wrote:
On Tue, Nov 10, 2020 at 08:28:08AM +0000, PG Doc comments form wrote:
> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/13/bug-reporting.html
> Description:
>
> Tablespace 'pg_global' is one of the two auto-generated tablespace by
> initdb, and 'pg_global' should not be used as the default_tablespace, since
> it is used for shared system catalogs. However, none of these information is
> recorded in the doc
> https://www.postgresql.org/docs/11/runtime-config-client.html and
> https://www.postgresql.org/docs/11/manage-ag-tablespaces.html. In case of
> some mishandling to use 'pg_global' as a default_tablespace value, it is
> better to record it in the doc of
> https://www.postgresql.org/docs/11/manage-ag-tablespaces.html.

I know this is three years old, but I am now looking at this email can
can't see the problem:

        SET default_tablespace = 'pg_global';

        CREATE TABLE test (x int);
        ERROR:  only shared relations can be placed in pg_global tablespace

Did you want an error from the SET command?

That would probably be a decent addition but the request was for us to add “it is not permissible to specify the pg_global tablespace for either default_tablespace or temp_tablespace”.  In the tablespace section per the request but maybe also within the settings definition section.

David J.

Re: 'pg_global' cannot be used as default_tablespace.

От
Tom Lane
Дата:
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Wednesday, November 1, 2023, Bruce Momjian <bruce@momjian.us> wrote:
>> Did you want an error from the SET command?

> That would probably be a decent addition but the request was for us to add
> “it is not permissible to specify the pg_global tablespace for either
> default_tablespace or temp_tablespace”.  In the tablespace section per the
> request but maybe also within the settings definition section.

But it *is* permissible, unless we add code to reject it during
SET as Bruce mentioned.  Which seems fairly pointless to me.  It's not
like there is anything unclear about the CREATE TABLE error message.

            regards, tom lane



Re: 'pg_global' cannot be used as default_tablespace.

От
Bruce Momjian
Дата:
On Wed, Nov  1, 2023 at 06:32:37PM -0400, Tom Lane wrote:
> "David G. Johnston" <david.g.johnston@gmail.com> writes:
> > On Wednesday, November 1, 2023, Bruce Momjian <bruce@momjian.us> wrote:
> >> Did you want an error from the SET command?
> 
> > That would probably be a decent addition but the request was for us to add
> > “it is not permissible to specify the pg_global tablespace for either
> > default_tablespace or temp_tablespace”.  In the tablespace section per the
> > request but maybe also within the settings definition section.
> 
> But it *is* permissible, unless we add code to reject it during
> SET as Bruce mentioned.  Which seems fairly pointless to me.  It's not
> like there is anything unclear about the CREATE TABLE error message.

Yeah, from the report I thought something bad happened if you tried to
use it and that is why we had to document it.  By documenting it we are
just giving the user advice before they get the error.  I wrote up this
minimal patch which might have the right level of detail to avoid
errors, if people think this is useful.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Only you can decide what is important to you.

Вложения

Re: 'pg_global' cannot be used as default_tablespace.

От
Tom Lane
Дата:
Bruce Momjian <bruce@momjian.us> writes:
> On Wed, Nov  1, 2023 at 06:32:37PM -0400, Tom Lane wrote:
>> But it *is* permissible, unless we add code to reject it during
>> SET as Bruce mentioned.  Which seems fairly pointless to me.  It's not
>> like there is anything unclear about the CREATE TABLE error message.

> Yeah, from the report I thought something bad happened if you tried to
> use it and that is why we had to document it.  By documenting it we are
> just giving the user advice before they get the error.  I wrote up this
> minimal patch which might have the right level of detail to avoid
> errors, if people think this is useful.

I think this will lead to just as much confusion, because people
will read it and expect that SET will fail.

If we need to document any more than we have now, we should point
out in the CREATE TABLE man page that you can't create a table in
the pg_global tablespace.  That will cover both this case and the
case of trying to select pg_global explicitly in the CREATE.

Another idea could be to adjust this bit in manage-ag.sgml:

   Two tablespaces are automatically created when the database cluster
   is initialized.  The
-  <literal>pg_global</literal> tablespace is used for shared system catalogs. The
+  <literal>pg_global</literal> tablespace is used for shared system catalogs,
+  and cannot be used for user-defined tables. The
   <literal>pg_default</literal> tablespace is the default tablespace of the

            regards, tom lane



Re: 'pg_global' cannot be used as default_tablespace.

От
Bruce Momjian
Дата:
On Wed, Nov  1, 2023 at 07:12:48PM -0400, Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> > On Wed, Nov  1, 2023 at 06:32:37PM -0400, Tom Lane wrote:
> >> But it *is* permissible, unless we add code to reject it during
> >> SET as Bruce mentioned.  Which seems fairly pointless to me.  It's not
> >> like there is anything unclear about the CREATE TABLE error message.
> 
> > Yeah, from the report I thought something bad happened if you tried to
> > use it and that is why we had to document it.  By documenting it we are
> > just giving the user advice before they get the error.  I wrote up this
> > minimal patch which might have the right level of detail to avoid
> > errors, if people think this is useful.
> 
> I think this will lead to just as much confusion, because people
> will read it and expect that SET will fail.
> 
> If we need to document any more than we have now, we should point
> out in the CREATE TABLE man page that you can't create a table in
> the pg_global tablespace.  That will cover both this case and the
> case of trying to select pg_global explicitly in the CREATE.
> 
> Another idea could be to adjust this bit in manage-ag.sgml:
> 
>    Two tablespaces are automatically created when the database cluster
>    is initialized.  The
> -  <literal>pg_global</literal> tablespace is used for shared system catalogs. The
> +  <literal>pg_global</literal> tablespace is used for shared system catalogs,
> +  and cannot be used for user-defined tables. The
>    <literal>pg_default</literal> tablespace is the default tablespace of the

I like the manage-ag.sgml change myself.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Only you can decide what is important to you.



Re: 'pg_global' cannot be used as default_tablespace.

От
Bruce Momjian
Дата:
On Wed, Nov  1, 2023 at 07:34:59PM -0400, Bruce Momjian wrote:
> On Wed, Nov  1, 2023 at 07:12:48PM -0400, Tom Lane wrote:
> > Bruce Momjian <bruce@momjian.us> writes:
> > > On Wed, Nov  1, 2023 at 06:32:37PM -0400, Tom Lane wrote:
> > >> But it *is* permissible, unless we add code to reject it during
> > >> SET as Bruce mentioned.  Which seems fairly pointless to me.  It's not
> > >> like there is anything unclear about the CREATE TABLE error message.
> > 
> > > Yeah, from the report I thought something bad happened if you tried to
> > > use it and that is why we had to document it.  By documenting it we are
> > > just giving the user advice before they get the error.  I wrote up this
> > > minimal patch which might have the right level of detail to avoid
> > > errors, if people think this is useful.
> > 
> > I think this will lead to just as much confusion, because people
> > will read it and expect that SET will fail.
> > 
> > If we need to document any more than we have now, we should point
> > out in the CREATE TABLE man page that you can't create a table in
> > the pg_global tablespace.  That will cover both this case and the
> > case of trying to select pg_global explicitly in the CREATE.
> > 
> > Another idea could be to adjust this bit in manage-ag.sgml:
> > 
> >    Two tablespaces are automatically created when the database cluster
> >    is initialized.  The
> > -  <literal>pg_global</literal> tablespace is used for shared system catalogs. The
> > +  <literal>pg_global</literal> tablespace is used for shared system catalogs,
> > +  and cannot be used for user-defined tables. The
> >    <literal>pg_default</literal> tablespace is the default tablespace of the
> 
> I like the manage-ag.sgml change myself.

I found a cleaner improvement, attached.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Only you can decide what is important to you.

Вложения

Re: 'pg_global' cannot be used as default_tablespace.

От
Tom Lane
Дата:
Bruce Momjian <bruce@momjian.us> writes:
> I found a cleaner improvement, attached.

OK by me.  Maybe that doesn't make the point strongly enough,
but we can hope it's enough.

            regards, tom lane



Re: 'pg_global' cannot be used as default_tablespace.

От
Bruce Momjian
Дата:
On Thu, Nov  2, 2023 at 09:58:54AM -0400, Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> > I found a cleaner improvement, attached.
> 
> OK by me.  Maybe that doesn't make the point strongly enough,
> but we can hope it's enough.

Agreed.  I thought last night about the sentence and realized when we
say pg_global is used for shared system catalogs, we are not saying
other object can't also be put there, so the "only" seemed required, and
once I added that, the second sentence fragment seemed unnecessary.

Plus, this report is from three years ago and I haven't seen any other
reports since then.

I also prefer manage-ag.sgml because we already talk about pg_global
there, and hopefully users of GUC tablespaces and CREATE TABLE will see
it there, or at least look for it when they get the error on creation.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Only you can decide what is important to you.



Re: 'pg_global' cannot be used as default_tablespace.

От
Bruce Momjian
Дата:
On Thu, Nov  2, 2023 at 11:08:53AM -0400, Bruce Momjian wrote:
> On Thu, Nov  2, 2023 at 09:58:54AM -0400, Tom Lane wrote:
> > Bruce Momjian <bruce@momjian.us> writes:
> > > I found a cleaner improvement, attached.
> > 
> > OK by me.  Maybe that doesn't make the point strongly enough,
> > but we can hope it's enough.
> 
> Agreed.  I thought last night about the sentence and realized when we
> say pg_global is used for shared system catalogs, we are not saying
> other object can't also be put there, so the "only" seemed required, and
> once I added that, the second sentence fragment seemed unnecessary.
> 
> Plus, this report is from three years ago and I haven't seen any other
> reports since then.
> 
> I also prefer manage-ag.sgml because we already talk about pg_global
> there, and hopefully users of GUC tablespaces and CREATE TABLE will see
> it there, or at least look for it when they get the error on creation.

Patch applied to master.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Only you can decide what is important to you.