pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedSuggestion: Explain how to move objects to the default tablespace in sql-altertable.html
5+ messages / 4 participants
[nested] [flat]
* Suggestion: Explain how to move objects to the default tablespace in sql-altertable.html
@ 2021-12-01 14:37 Holger Jakobs <holger@jakobs.com>
0 siblings, 1 reply; 5+ messages in thread
From: Holger Jakobs @ 2021-12-01 14:37 UTC (permalink / raw)
To: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
Hello,
Today I wanted to move an object to the unnamed defaul tablespace. It
took me a while to find out that neither the empty string '' nor the
word default works, but that you have to use pg_default.
This should be mentioned in the documentation of the ALTER TABLE command
(and maybe others).
--
Holger Jakobs, Bergisch Gladbach, Tel. +49-178-9759012
Attachments:
OpenPGP_signature (application/pgp-signature, 202B) download
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Suggestion: Explain how to move objects to the default tablespace in sql-altertable.html
@ 2021-12-01 15:14 Laurenz Albe <laurenz.albe@cybertec.at>
parent: Holger Jakobs <holger@jakobs.com>
0 siblings, 1 reply; 5+ messages in thread
From: Laurenz Albe @ 2021-12-01 15:14 UTC (permalink / raw)
To: Holger Jakobs <holger@jakobs.com>; pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
On Wed, 2021-12-01 at 15:37 +0100, Holger Jakobs wrote:
> Today I wanted to move an object to the unnamed defaul tablespace. It
> took me a while to find out that neither the empty string '' nor the
> word default works, but that you have to use pg_default.
>
> This should be mentioned in the documentation of the ALTER TABLE command
> (and maybe others).
Not sure if that is necessary. You have to use the name of the tablespace.
You can see that with "\db" in psql or query "pg_tablespace".
That's no different from other tablespaces...
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Suggestion: Explain how to move objects to the default tablespace in sql-altertable.html
@ 2021-12-01 15:44 David G. Johnston <david.g.johnston@gmail.com>
parent: Laurenz Albe <laurenz.albe@cybertec.at>
0 siblings, 1 reply; 5+ messages in thread
From: David G. Johnston @ 2021-12-01 15:44 UTC (permalink / raw)
To: Laurenz Albe <laurenz.albe@cybertec.at>; +Cc: Holger Jakobs <holger@jakobs.com>; pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
On Wed, Dec 1, 2021 at 8:14 AM Laurenz Albe <laurenz.albe@cybertec.at>
wrote:
> On Wed, 2021-12-01 at 15:37 +0100, Holger Jakobs wrote:
> > Today I wanted to move an object to the unnamed defaul tablespace. It
> > took me a while to find out that neither the empty string '' nor the
> > word default works, but that you have to use pg_default.
> >
> > This should be mentioned in the documentation of the ALTER TABLE command
> > (and maybe others).
>
> Not sure if that is necessary. You have to use the name of the tablespace.
> You can see that with "\db" in psql or query "pg_tablespace".
>
> That's no different from other tablespaces...
>
>
The documentation flow for the common case described here is:
ALTER TABLE ->
CREATE TABLE (which is not linked to from the ALTER TABLE TABLESPACE clause
entry) ->
default_tablespace GUC (which is directly linked to) ->
Read that if the GUC value is the empty string (typical) that the database
default is used ->
Now link over to 23.6 (Managing Databases - Tablespaces) to learn that the
specific value of the tablespace for the database is "pg_default" ->
And since other tablespaces are seemingly in use perform further research
using the 23.6 information to check exactly what is the current database
default is
I'm not quite sold on "the status quo is great" based upon that chain of
reading. Especially since default_tablespace is content on returning an
empty string as opposed to a tablespace name.
I don't have a problem updating CREATE TABLE to be more detailed, and then
(maybe) update ALTER TABLE to more directly reference CREATE TABLE if one
needs to learn about choosing a valid value for changing the tablespace
name to the database default. Or, maybe skip the GUC page and link
directly to 23.6 in both and improve the description provided therein. But
saying that ALTER TABLE is the primary problem spot seems biased by the
specific report. ALTER pages are rarely the place to be learning about how
different features work - the CREATE page is the primary entry point, and
by that general policy there is probably no pressing need to make the ALTER
TABLE page directly link to CREATE TABLE in this specific situation (or
even point to default_tablespace or even 23.6 directly).
David J.
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Suggestion: Explain how to move objects to the default tablespace in sql-altertable.html
@ 2021-12-01 15:49 Holger Jakobs <holger@jakobs.com>
parent: David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 1 reply; 5+ messages in thread
From: Holger Jakobs @ 2021-12-01 15:49 UTC (permalink / raw)
To: pgsql-admin@lists.postgresql.org
Am 01.12.21 um 16:44 schrieb David G. Johnston:
> On Wed, Dec 1, 2021 at 8:14 AM Laurenz Albe <laurenz.albe@cybertec.at>
> wrote:
>
> On Wed, 2021-12-01 at 15:37 +0100, Holger Jakobs wrote:
> > Today I wanted to move an object to the unnamed defaul
> tablespace. It
> > took me a while to find out that neither the empty string '' nor
> the
> > word default works, but that you have to use pg_default.
> >
> > This should be mentioned in the documentation of the ALTER TABLE
> command
> > (and maybe others).
>
> Not sure if that is necessary. You have to use the name of the
> tablespace.
> You can see that with "\db" in psql or query "pg_tablespace".
>
> That's no different from other tablespaces...
>
>
> The documentation flow for the common case described here is:
>
> ALTER TABLE ->
> CREATE TABLE (which is not linked to from the ALTER TABLE TABLESPACE
> clause entry) ->
> default_tablespace GUC (which is directly linked to) ->
> Read that if the GUC value is the empty string (typical) that the
> database default is used ->
> Now link over to 23.6 (Managing Databases - Tablespaces) to learn that
> the specific value of the tablespace for the database is "pg_default" ->
> And since other tablespaces are seemingly in use perform further
> research using the 23.6 information to check exactly what is the
> current database default is
>
> I'm not quite sold on "the status quo is great" based upon that chain
> of reading. Especially since default_tablespace is content on
> returning an empty string as opposed to a tablespace name.
>
> I don't have a problem updating CREATE TABLE to be more detailed, and
> then (maybe) update ALTER TABLE to more directly reference CREATE
> TABLE if one needs to learn about choosing a valid value for changing
> the tablespace name to the database default. Or, maybe skip the GUC
> page and link directly to 23.6 in both and improve the description
> provided therein. But saying that ALTER TABLE is the primary problem
> spot seems biased by the specific report. ALTER pages are rarely the
> place to be learning about how different features work - the CREATE
> page is the primary entry point, and by that general policy there is
> probably no pressing need to make the ALTER TABLE page directly link
> to CREATE TABLE in this specific situation (or even point to
> default_tablespace or even 23.6 directly).
>
> David J.
>
Therefore I mentioned "and maybe others". But I had other ALTER-commands
in mind.
Since the default tablespace doesn't have to be mentioned in CREATing an
object, the information wouldn't be helpful there.
But when ALTERing an object in order to move it to the default
tablespace, its name has to be mentioned explicitly. That's where it's
lacking.
--
Holger Jakobs, Bergisch Gladbach, Tel. +49-178-9759012
Attachments:
OpenPGP_signature (application/pgp-signature, 202B) download
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Suggestion: Explain how to move objects to the default tablespace in sql-altertable.html
@ 2021-12-01 16:16 Tom Lane <tgl@sss.pgh.pa.us>
parent: Holger Jakobs <holger@jakobs.com>
0 siblings, 0 replies; 5+ messages in thread
From: Tom Lane @ 2021-12-01 16:16 UTC (permalink / raw)
To: Holger Jakobs <holger@jakobs.com>; +Cc: pgsql-admin@lists.postgresql.org
Holger Jakobs <holger@jakobs.com> writes:
> Since the default tablespace doesn't have to be mentioned in CREATing an
> object, the information wouldn't be helpful there.
> But when ALTERing an object in order to move it to the default
> tablespace, its name has to be mentioned explicitly. That's where it's
> lacking.
It seems like the core misunderstanding here is closely associated
with the notion that the default tablespace is "unnamed". Every
tablespace has a name. I'm not sure where we might need to clarify
that, but I suspect it's somewhere around the default_tablespace
setting, not ALTER TABLE.
regards, tom lane
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2021-12-01 16:16 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-12-01 14:37 Suggestion: Explain how to move objects to the default tablespace in sql-altertable.html Holger Jakobs <holger@jakobs.com>
2021-12-01 15:14 ` Laurenz Albe <laurenz.albe@cybertec.at>
2021-12-01 15:44 ` David G. Johnston <david.g.johnston@gmail.com>
2021-12-01 15:49 ` Holger Jakobs <holger@jakobs.com>
2021-12-01 16:16 ` Tom Lane <tgl@sss.pgh.pa.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