Re: pgbench - allow to create partitioned tables

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Asif Rehman <asifr(dot)rehman(at)gmail(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgbench - allow to create partitioned tables
Date: 2019-09-30 08:56:21
Message-ID: alpine.DEB.2.21.1909300839100.26631@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello Amit,

>> Attached v18:
>> - remove the test tablespace
>> I had to work around a strange issue around partitioned tables and
>> the default tablespace.
>
> - if (tablespace != NULL)
> + if (tablespace != NULL && strcmp(tablespace, "pg_default") != 0)
>
> [...]
>
> I don't think we need any such check, rather if the user gives
> default_tablespace with 'partitions' option, then let it fail with an
> error "cannot specify default tablespace for partitioned relations".

That is the one I wanted to avoid, which is triggered by TAP tests, but
I'm fine with putting back a tablespace. Given partitioned table strange
constraints, ISTM desirable to check that it works with options such as
tablespace and fillfactor.

> (b) Create a non-default tablespace to test partitions with "all
> possible options" test as you have in your previous version.

> Also, add a comment explaining why in that test we are using non-default
> tablespace.

> I am leaning towards approach (b) unless you and or Alvaro feels (a)
> is good for now or if you have some other idea.

No other idea. I put back the tablespace creation which I just removed,
with comments about why it is there.

> If we want to go with option (b), I have small comment in your previous test:
> +# tablespace for testing
> +my $ts = $node->basedir . '/regress_pgbench_tap_1_ts_dir';
> +mkdir $ts or die "cannot create directory $ts";
> +my $ets = TestLib::perl2host($ts);
> +# add needed escaping!
> +$ets =~ s/'/''/;
>
> I am not sure if we really need this quote skipping stuff. Why can't
> we write the test as below:
>
> # tablespace for testing
> my $basedir = $node->basedir;
> my $ts = "$basedir/regress_pgbench_tap_1_ts_dir";
> mkdir $ts or die "cannot create directory $ts";
> $ts = TestLib::perl2host($ts);
> $node->safe_psql('postgres',
> "CREATE TABLESPACE regress_pgbench_tap_1_ts LOCATION '$ets';"

I think that this last command fails if the path contains a "'", so the
'-escaping is necessary. I had to make changes in TAP tests before because
it was not working when the path was a little bit strange, so now I'm
careful.

Attached v19:
- put back a local tablespace plus comments
- remove the pg_default doubtful workaround.

--
Fabien.

Attachment Content-Type Size
pgbench-init-partitioned-19.patch text/x-diff 16.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2019-09-30 09:13:51 Re: Usage of the system truststore for SSL certificate validation
Previous Message Alexey Kondratov 2019-09-30 08:51:25 Re: Two pg_rewind patches (auto generate recovery conf and ensure clean shutdown)