Thread: SubTablespaces(Recursive) expected behaviour?

SubTablespaces(Recursive) expected behaviour?

From
Stepan Neretin
Date:
Hi, please tell me what is the expected behavior if I create a tablespace tbl1 in /data, and then create a tablespace tbl2 in /data/tbl2 There is nothing written in the documentation about this. Will the behavior of tbl2 change somehow?

Re: SubTablespaces(Recursive) expected behaviour?

From
"David G. Johnston"
Date:
On Sunday, July 28, 2024, Stepan Neretin <sncfmgg@gmail.com> wrote:
Hi, please tell me what is the expected behavior if I create a tablespace tbl1 in /data, and then create a tablespace tbl2 in /data/tbl2 There is nothing written in the documentation about this. Will the behavior of tbl2 change somehow?


David J. 

Re: SubTablespaces(Recursive) expected behaviour?

From
Stepan Neretin
Date:


On Sun, Jul 28, 2024 at 10:47 PM David G. Johnston <david.g.johnston@gmail.com> wrote:
On Sunday, July 28, 2024, Stepan Neretin <sncfmgg@gmail.com> wrote:
Hi, please tell me what is the expected behavior if I create a tablespace tbl1 in /data, and then create a tablespace tbl2 in /data/tbl2 There is nothing written in the documentation about this. Will the behavior of tbl2 change somehow?


David J. 

Hi, David. I have read this page several times and have not answered my question. I'm probably not paying attention. Can you, I wanted to quote what I'm missing out on? Best Regards, Stepan Neretin!

Re: SubTablespaces(Recursive) expected behaviour?

From
"David G. Johnston"
Date:

On Sunday, July 28, 2024, Stepan Neretin <sncfmgg@gmail.com> wrote:
On Sun, Jul 28, 2024 at 10:47 PM David G. Johnston <david.g.johnston@gmail.com> wrote:
On Sunday, July 28, 2024, Stepan Neretin <sncfmgg@gmail.com> wrote:
Hi, please tell me what is the expected behavior if I create a tablespace tbl1 in /data, and then create a tablespace tbl2 in /data/tbl2 There is nothing written in the documentation about this. Will the behavior of tbl2 change somehow?


Hi, David. I have read this page several times and have not answered my question. I'm probably not paying attention. Can you, I wanted to quote what I'm missing out on

 “The location must be an existing, empty directory that is owned by the PostgreSQL operating system user.”

David J.

Re: SubTablespaces(Recursive) expected behaviour?

From
Tom Lane
Date:
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Sunday, July 28, 2024, Stepan Neretin <sncfmgg@gmail.com> wrote:
>> Hi, David. I have read this page several times and have not answered my
>> question. I'm probably not paying attention. Can you, I wanted to quote
>> what I'm missing out on

>  “The location must be an existing, empty directory that is owned by the
> PostgreSQL operating system user.”

Indeed, that doesn't directly answer the question, but I think the
implication is clear: we do not expect a tablespace directory to
contain anything except files that Postgres itself puts there.

I don't actually see the point of the described setup anyway.  There
is zero value that I can see in putting two tablespaces on the same
physical volume --- they won't provide any interesting separation.

            regards, tom lane



Re: SubTablespaces(Recursive) expected behaviour?

From
"David G. Johnston"
Date:
On Sunday, July 28, 2024, Tom Lane <tgl@sss.pgh.pa.us> wrote:
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Sunday, July 28, 2024, Stepan Neretin <sncfmgg@gmail.com> wrote:
>> Hi, David. I have read this page several times and have not answered my
>> question. I'm probably not paying attention. Can you, I wanted to quote
>> what I'm missing out on

>  “The location must be an existing, empty directory that is owned by the
> PostgreSQL operating system user.”

Indeed, that doesn't directly answer the question, but I think the
implication is clear: we do not expect a tablespace directory to
contain anything except files that Postgres itself puts there.

Ok, so the flow is:
Mkdir data
Create tablespace data
Mkdir data/tbl2
Create tablespace /data/tbl2

Both creates meet the preconditions, and while creating unrelated files within an existing tablespace directory is frowned upon and risky it isn’t something that is going to guarantee failure or can be prohibited.

Just bite the bullet and move the first tablespace to a better location, or leave things as is since, assuming /data/tbl2 is on the same filesystem as /data, the second tablespace isn’t isolated anyway, as Tom said.

David J.