[prev in list] [next in list] [prev in thread] [next in thread]
List: pgsql-bugs
Subject: Re: BUG #18167: cannot create partitioned tables when default_tablespace is set
From: tender wang <tndrwang () gmail ! com>
Date: 2023-10-25 9:58:21
Message-ID: CAHewXNmE8uRHFBiMXT2o0s19=xHpyc0gTLOf1cdc1C6BwqAwGQ () mail ! gmail ! com
[Download RAW message or body]
Alvaro Herrera <alvherre@alvh.no-ip.org> 于2023年10月25日周三 17:41写道:
> On 2023-Oct-24, PG Bug reporting form wrote:
>
> > marius@[local]:5434/postgres=# show default_tablespace;
> > default_tablespace
> > --------------------
> > tblspc1
> > (1 row)
> >
> > marius@[local]:5434/postgres=# create tablespace tblspc1 location
> > '/home/marius/pgcode/tblspc1';
> > CREATE TABLESPACE
> > marius@[local]:5434/postgres=# create database test tablespace tblspc1;
> > CREATE DATABASE
> > marius@[local]:5434/postgres=# \c test
> > You are now connected to database "test" as user "marius".
> > marius@[local]:5434/test=# create table toto(id numeric) partition by
> > list(id);
> > ERROR: cannot specify default tablespace for partitioned relations
>
> Oh, so the problem here is that *both* default_tablespace and the
> database's tablespace are set, and then a partitioned table creation
> fails when it doesn't specify any tablespace? That indeed sounds like a
> bug. I'll have a look, thanks. I'm surprised it took so long for this
> to be reported.
>
Oh, interesting issue!
I found another two case:
First: default_tablespace not set and create part rel failed
postgres=# create tablespace tbsp3 location '/tender/pgsql/tbsp3';
CREATE TABLESPACE
postgres=# create database test3 tablespace tbsp3;
CREATE DATABASE
postgres=# \c test3
You are now connected to database "test3" as user "gpadmin".
test3=# show default_tablespace ;
default_tablespace
--------------------
(1 row)
test3=# create table part1(a int) partition by list(a) tablespace tbsp3;
ERROR: cannot specify default tablespace for partitioned relations
Second: default_tablespace and database's tablespace both set, but part rel
created
test3=# set default_tablespace = tbsp2;
SET
test3=# create table part1(a int) partition by list(a);
CREATE TABLE
I'm not sure if the above two cases are a bug. If the document could
provide detailed explanations, that would be great.
> --
> Álvaro Herrera 48 01'N 7 57'E —
> https://www.EnterpriseDB.com/
> "Someone said that it is at least an order of magnitude more work to do
> production software than a prototype. I think he is wrong by at least
> an order of magnitude." (Brian Kernighan)
>
>
>
>
>
[Attachment #3 (text/html)]
<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" \
class="gmail_attr">Alvaro Herrera <<a \
href="mailto:alvherre@alvh.no-ip.org">alvherre@alvh.no-ip.org</a>> \
于2023年10月25日周三 17:41写道:<br></div><blockquote class="gmail_quote" \
style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex">On 2023-Oct-24, PG Bug reporting form wrote:<br> \
<br> > marius@[local]:5434/postgres=# show default_tablespace;<br>
> default_tablespace <br>
> --------------------<br>
> tblspc1<br>
> (1 row)<br>
> <br>
> marius@[local]:5434/postgres=# create tablespace tblspc1 location<br>
> '/home/marius/pgcode/tblspc1';<br>
> CREATE TABLESPACE<br>
> marius@[local]:5434/postgres=# create database test tablespace tblspc1;<br>
> CREATE DATABASE<br>
> marius@[local]:5434/postgres=# \c test<br>
> You are now connected to database "test" as user \
"marius".<br> > marius@[local]:5434/test=# create table toto(id numeric) \
partition by<br> > list(id);<br>
> ERROR: cannot specify default tablespace for partitioned relations<br>
<br>
Oh, so the problem here is that *both* default_tablespace and the<br>
database's tablespace are set, and then a partitioned table creation<br>
fails when it doesn't specify any tablespace? That indeed sounds like a<br>
bug. I'll have a look, thanks. I'm surprised it took so long for this<br>
to be reported.<br></blockquote><div> </div><div>Oh, interesting \
issue!<br></div><div>I found another two case:</div><div>First: default_tablespace \
not set and create part rel failed</div><div>postgres=# create tablespace tbsp3 \
location '/tender/pgsql/tbsp3';<br>CREATE TABLESPACE<br>postgres=# create \
database test3 tablespace tbsp3;<br>CREATE DATABASE<br>postgres=# \c test3<br>You are \
now connected to database "test3" as user "gpadmin".<br>test3=# \
show default_tablespace ;<br> default_tablespace <br>--------------------<br> \
<br>(1 row)<br><br>test3=# create table part1(a int) partition by list(a) tablespace \
tbsp3;<br>ERROR: cannot specify default tablespace for partitioned \
relations<br></div><div><br></div><div>Second: default_tablespace and database's \
tablespace both set, but part rel created</div><div>test3=# set default_tablespace = \
tbsp2;<br>SET<br>test3=# create table part1(a int) partition by list(a);<br>CREATE \
TABLE<br></div><div><br></div><div>I'm not sure if the above two cases are a bug. \
If the document could provide detailed explanations, that would be \
great.</div><div><br></div><div> </div><blockquote class="gmail_quote" \
style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex">
-- <br>
Álvaro Herrera 48 01'N 7 57'E — <a \
href="https://www.EnterpriseDB.com/" rel="noreferrer" \
target="_blank">https://www.EnterpriseDB.com/</a><br> "Someone said that it is \
at least an order of magnitude more work to do<br> production software than a \
prototype. I think he is wrong by at least<br> an order of magnitude." \
(Brian Kernighan)<br> <br>
<br>
<br>
<br>
</blockquote></div></div>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic