Re: CREATE DATABASE with tablespace fix

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, pgsql-patches(at)postgresql(dot)org
Subject: Re: CREATE DATABASE with tablespace fix
Date: 2004-08-16 01:08:04
Message-ID: 200408160108.i7G184P06124@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


Added to open items:

* fix case where template db already uses target tablespace

---------------------------------------------------------------------------

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > I am a little confused why we can't just merge the directories? The
> > relfilenodes would guarantee that the files are unique, right?
>
> Actually not: there is no uniqueness check on relfilenode beyond the
> indirect one of the files having to live in the same directory. In the
> tablespace world it will be possible for tables in different tablespaces
> to have conflicting relfilenodes. Admittedly this should be rare and
> it's probably good enough to fail only if a collision occurs --- but
> it's something that would have to be kept in mind while coding.
>
> Another issue is that since we aren't changing the template's pg_class,
> we would end up with a database in which some tables refer to the
> database's default tablespace explicitly (reltablespace = its OID) and
> some refer to it implicitly (reltablespace = 0). I'm not sure what the
> consequences of that are, but it might not be good. It would definitely
> be a state that you couldn't get into "normally". (One fairly likely
> scenario for failure is if you then try to copy this database and change
> the default TS again...)
>
> > Seems we should apply this patch
>
> I think it needs more thought. I've been busy with other issues and
> haven't expended any cycles on the problem myself ...
>
> regards, tom lane
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Philip Warner 2004-08-16 01:10:18 Re: pg_dump 'die_on_errors'
Previous Message Tom Lane 2004-08-16 00:58:01 Re: CREATE DATABASE with tablespace fix