Re: Suggestion: Explain how to move objects to the default tablespace in sql-altertable.html

Поиск
Список
Период
Сортировка
От Holger Jakobs
Тема Re: Suggestion: Explain how to move objects to the default tablespace in sql-altertable.html
Дата
Msg-id 49d925d5-b13a-5952-0be3-fc20b271f22c@jakobs.com
обсуждение исходный текст
Ответ на Re: Suggestion: Explain how to move objects to the default tablespace in sql-altertable.html  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: Suggestion: Explain how to move objects to the default tablespace in sql-altertable.html  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-admin
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
Вложения

В списке pgsql-admin по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: Suggestion: Explain how to move objects to the default tablespace in sql-altertable.html
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Suggestion: Explain how to move objects to the default tablespace in sql-altertable.html