Thread: BUG #18709: Explicit tablespace pg_default not working when creating of indices in partitioned tables

The following bug has been logged on the website:

Bug reference:      18709
Logged by:          Ondřej Navrátil
Email address:      onavratil@monetplus.cz
PostgreSQL version: 14.13
Operating system:   Linux
Description:

Long story short, lets have a partitioned table:
```
create table test_table (
  id integer,
  description text
) partition BY range(id);
```
...and create some tablespace. Now this works nicely:
```
create index descri_index on test_table (description) tablespace
my_custom_tablespace;
```
..but for some reason, the same returns an error when pg_default is
explicitly requested as a tablespace
```
create index descri_index2 on test_table (description) tablespace
pg_default;
```
psql:commands.sql:9: ERROR:  cannot specify default tablespace for
partitioned relations

In some versions, same applies to `create table ... partitioned by` - using
a custom tablespace works, but explicitly denoting pg_default as the target
yields an error.