avoid create a tablespace in pg_tblspc

Started by Jaime Casanovaover 17 years ago3 messages
#1Jaime Casanova
jcasanov@systemguards.com.ec
1 attachment(s)

Hi,

bug report http://archives.postgresql.org/pgsql-bugs/2008-10/msg00037.php
seems like a reasonably request to me... and one that is simple to
fulfill, just create a PG_VERSION in the pg_tblspc dir at initdb.
if no one objects, here is a one linear patch for that

--
regards,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Asesoría y desarrollo de sistemas
Guayaquil - Ecuador
Cel. +59387171157

Attachments:

pg_tblspc.patchtext/x-diff; name=pg_tblspc.patchDownload
Index: src/bin/initdb/initdb.c
===================================================================
RCS file: /var/lib/postgresql/CVSREPO/pgsql/src/bin/initdb/initdb.c,v
retrieving revision 1.162
diff -c -r1.162 initdb.c
*** src/bin/initdb/initdb.c	30 Sep 2008 10:52:13 -0000	1.162
--- src/bin/initdb/initdb.c	9 Oct 2008 20:26:56 -0000
***************
*** 3128,3133 ****
--- 3128,3138 ----
  	bootstrap_template1(short_version);
  
  	/*
+ 	 * Disallow use pg_data/pg_tblspc itself as a location for a tablespace
+ 	 */
+ 	set_short_version(short_version, "pg_tblspc");
+ 
+ 	/*
  	 * Make the per-database PG_VERSION for template1 only after init'ing it
  	 */
  	set_short_version(short_version, "base/1");
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Jaime Casanova (#1)
Re: avoid create a tablespace in pg_tblspc

"Jaime Casanova" <jcasanov@systemguards.com.ec> writes:

bug report http://archives.postgresql.org/pgsql-bugs/2008-10/msg00037.php
seems like a reasonably request to me... and one that is simple to
fulfill, just create a PG_VERSION in the pg_tblspc dir at initdb.

I don't think it's a reasonable request. If we take this seriously,
we'd have to buy into making sure that no subdirectory of $PGDATA is
ever empty. Which is silly. And what of empty directories elsewhere?
There are any number of ways to shoot yourself in the foot with a bad
choice of tablespace location --- I don't find this one more dangerous
than any other.

regards, tom lane

#3Jaime Casanova
jcasanov@systemguards.com.ec
In reply to: Tom Lane (#2)
Re: avoid create a tablespace in pg_tblspc

On Thu, Oct 9, 2008 at 6:22 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

"Jaime Casanova" <jcasanov@systemguards.com.ec> writes:

bug report http://archives.postgresql.org/pgsql-bugs/2008-10/msg00037.php
seems like a reasonably request to me... and one that is simple to
fulfill, just create a PG_VERSION in the pg_tblspc dir at initdb.

I don't think it's a reasonable request. If we take this seriously,
we'd have to buy into making sure that no subdirectory of $PGDATA is
ever empty. Which is silly. And what of empty directories elsewhere?
There are any number of ways to shoot yourself in the foot with a bad
choice of tablespace location --- I don't find this one more dangerous
than any other.

well, this one can at least create a tablespace that never can be dropped

--
Atentamente,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Asesoría y desarrollo de sistemas
Guayaquil - Ecuador
Cel. +59387171157