pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
'pg_global' cannot be used as default_tablespace.
11+ messages / 4 participants
[nested] [flat]

* 'pg_global' cannot be used as default_tablespace.
@ 2020-11-10 08:28  PG Doc comments form <noreply@postgresql.org>
  0 siblings, 1 reply; 11+ messages in thread

From: PG Doc comments form @ 2020-11-10 08:28 UTC (permalink / raw)
  To: pgsql-docs@lists.postgresql.org; +Cc: zhoushulin1992@gmail.com

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.


^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: 'pg_global' cannot be used as default_tablespace.
@ 2023-11-01 22:15  Bruce Momjian <bruce@momjian.us>
  parent: PG Doc comments form <noreply@postgresql.org>
  0 siblings, 1 reply; 11+ messages in thread

From: Bruce Momjian @ 2023-11-01 22:15 UTC (permalink / raw)
  To: zhoushulin1992@gmail.com; pgsql-docs@lists.postgresql.org

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.





^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: 'pg_global' cannot be used as default_tablespace.
@ 2023-11-01 22:26  David G. Johnston <david.g.johnston@gmail.com>
  parent: Bruce Momjian <bruce@momjian.us>
  0 siblings, 1 reply; 11+ messages in thread

From: David G. Johnston @ 2023-11-01 22:26 UTC (permalink / raw)
  To: Bruce Momjian <bruce@momjian.us>; +Cc: zhoushulin1992@gmail.com <zhoushulin1992@gmail.com>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>

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.

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: 'pg_global' cannot be used as default_tablespace.
@ 2023-11-01 22:32  Tom Lane <tgl@sss.pgh.pa.us>
  parent: David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 11+ messages in thread

From: Tom Lane @ 2023-11-01 22:32 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: Bruce Momjian <bruce@momjian.us>; zhoushulin1992@gmail.com <zhoushulin1992@gmail.com>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>

"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





^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: 'pg_global' cannot be used as default_tablespace.
@ 2023-11-01 22:51  Bruce Momjian <bruce@momjian.us>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 11+ messages in thread

From: Bruce Momjian @ 2023-11-01 22:51 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; zhoushulin1992@gmail.com <zhoushulin1992@gmail.com>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>

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.

Attachments:

  [text/x-diff] tablespace.diff (1.3K, ../../ZULWiAskl5qtYZN8@momjian.us/2-tablespace.diff)
  download | inline diff:
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index bd70ff2e4b..7179d6273c 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -8706,7 +8706,8 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
 
        <para>
         The value is either the name of a tablespace, or an empty string
-        to specify using the default tablespace of the current database.
+        to specify using the default tablespace of the current database;
+        <literal>pg_global</literal> cannot be used.
         If the value does not match the name of any existing tablespace,
         <productname>PostgreSQL</productname> will automatically use the default
         tablespace of the current database.  If a nondefault tablespace
@@ -8774,7 +8775,8 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
        <para>
         This variable specifies tablespaces in which to create temporary
         objects (temp tables and indexes on temp tables) when a
-        <command>CREATE</command> command does not explicitly specify a tablespace.
+        <command>CREATE</command> command does not explicitly specify a tablespace;
+        <literal>pg_global</literal> cannot be used.
         Temporary files for purposes such as sorting large data sets
         are also created in these tablespaces.
        </para>

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: 'pg_global' cannot be used as default_tablespace.
@ 2023-11-01 23:12  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Bruce Momjian <bruce@momjian.us>
  0 siblings, 1 reply; 11+ messages in thread

From: Tom Lane @ 2023-11-01 23:12 UTC (permalink / raw)
  To: Bruce Momjian <bruce@momjian.us>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; zhoushulin1992@gmail.com <zhoushulin1992@gmail.com>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>

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





^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: 'pg_global' cannot be used as default_tablespace.
@ 2023-11-01 23:34  Bruce Momjian <bruce@momjian.us>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 11+ messages in thread

From: Bruce Momjian @ 2023-11-01 23:34 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; zhoushulin1992@gmail.com <zhoushulin1992@gmail.com>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>

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.





^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: 'pg_global' cannot be used as default_tablespace.
@ 2023-11-02 13:43  Bruce Momjian <bruce@momjian.us>
  parent: Bruce Momjian <bruce@momjian.us>
  0 siblings, 1 reply; 11+ messages in thread

From: Bruce Momjian @ 2023-11-02 13:43 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; zhoushulin1992@gmail.com <zhoushulin1992@gmail.com>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>

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.

Attachments:

  [text/x-diff] tablespace.diff (741B, ../../ZUOndqOz89dpD8T6@momjian.us/2-tablespace.diff)
  download | inline diff:
diff --git a/doc/src/sgml/manage-ag.sgml b/doc/src/sgml/manage-ag.sgml
index 192c500994..a02ef632c3 100644
--- a/doc/src/sgml/manage-ag.sgml
+++ b/doc/src/sgml/manage-ag.sgml
@@ -498,7 +498,7 @@ CREATE TABLE foo(i int);
   <para>
    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 only for shared system catalogs. The
    <literal>pg_default</literal> tablespace is the default tablespace of the
    <literal>template1</literal> and <literal>template0</literal> databases (and, therefore,
    will be the default tablespace for other databases as well, unless

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: 'pg_global' cannot be used as default_tablespace.
@ 2023-11-02 13:58  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Bruce Momjian <bruce@momjian.us>
  0 siblings, 1 reply; 11+ messages in thread

From: Tom Lane @ 2023-11-02 13:58 UTC (permalink / raw)
  To: Bruce Momjian <bruce@momjian.us>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; zhoushulin1992@gmail.com <zhoushulin1992@gmail.com>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>

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





^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: 'pg_global' cannot be used as default_tablespace.
@ 2023-11-02 15:08  Bruce Momjian <bruce@momjian.us>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 11+ messages in thread

From: Bruce Momjian @ 2023-11-02 15:08 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; zhoushulin1992@gmail.com <zhoushulin1992@gmail.com>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>

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.





^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: 'pg_global' cannot be used as default_tablespace.
@ 2023-11-13 19:53  Bruce Momjian <bruce@momjian.us>
  parent: Bruce Momjian <bruce@momjian.us>
  0 siblings, 0 replies; 11+ messages in thread

From: Bruce Momjian @ 2023-11-13 19:53 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; zhoushulin1992@gmail.com <zhoushulin1992@gmail.com>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>

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.





^ permalink  raw  reply  [nested|flat] 11+ messages in thread


end of thread, other threads:[~2023-11-13 19:53 UTC | newest]

Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10 08:28 'pg_global' cannot be used as default_tablespace. PG Doc comments form <noreply@postgresql.org>
2023-11-01 22:15 ` Bruce Momjian <bruce@momjian.us>
2023-11-01 22:26   ` David G. Johnston <david.g.johnston@gmail.com>
2023-11-01 22:32     ` Tom Lane <tgl@sss.pgh.pa.us>
2023-11-01 22:51       ` Bruce Momjian <bruce@momjian.us>
2023-11-01 23:12         ` Tom Lane <tgl@sss.pgh.pa.us>
2023-11-01 23:34           ` Bruce Momjian <bruce@momjian.us>
2023-11-02 13:43             ` Bruce Momjian <bruce@momjian.us>
2023-11-02 13:58               ` Tom Lane <tgl@sss.pgh.pa.us>
2023-11-02 15:08                 ` Bruce Momjian <bruce@momjian.us>
2023-11-13 19:53                   ` Bruce Momjian <bruce@momjian.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox