Re: pgbench - allow to create partitioned tables - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: pgbench - allow to create partitioned tables
Date
Msg-id CAA4eK1Kpw3s8BrsfwMq99ca=p11r8gzmVg+p86eS9ru=fX8ZTQ@mail.gmail.com
Whole thread Raw
In response to Re: pgbench - allow to create partitioned tables  (Fabien COELHO <coelho@cri.ensmp.fr>)
Responses Re: pgbench - allow to create partitioned tables
List pgsql-hackers
On Tue, Sep 24, 2019 at 6:59 PM Fabien COELHO <coelho@cri.ensmp.fr> wrote:
>
> > For you or me, it might be okay as we have discussed this case, but it
> > won't be apparent to others.  This doesn't buy us much, so it is better
> > to keep this code consistent with other places that check for
> > partitions.
>
> Attached uses "partition_method != PART_NONE" consistently, plus an assert
> on "partitions > 0" for checking and for triggering the default method at
> the end of option processing.
>

Okay, I think making the check consistent is a step forward.  The
latest patch is not compiling for me.  You have used the wrong
variable name in below line:
+ /* Partition pgbench_accounts table */
+ if (partitions_method != PART_NONE && strcmp(ddl->table,
"pgbench_accounts") == 0)

Another point is:
+ else if (PQntuples(res) == 0)
+ {
+ /*
+ * This case is unlikely as pgbench already found "pgbench_branches"
+ * above to compute the scale.
+ */
+ fprintf(stderr,
+ "No pgbench_accounts table found in search_path. "
+ "Perhaps you need to do initialization (\"pgbench -i\") in database
\"%s\"\n", PQdb(con));

We don't recommend to start messages with a capital letter.  See
"Upper Case vs. Lower Case" section in docs [1].  It is not that we
have not used it anywhere else, but I think we should try to avoid it.

[1] - https://www.postgresql.org/docs/devel/error-style-guide.html

-- 
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: A comment fix in xlogreader.c
Next
From: Michael Paquier
Date:
Subject: Re: PostgreSQL12 and older versions of OpenSSL