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 CAA4eK1JuWXVRhn0k1fX4AacE=FE3ebc+xJ1eFnEOO9qArdy=5Q@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 17, 2019 at 6:38 PM Fabien COELHO <coelho@cri.ensmp.fr> wrote:
>
>
> >> It is used at one place where we can set PART_NONE without much loss.
> >> Having lesser invalid values makes code easier to follow.
> >
> > Looking more closely at this case:
> > + else if (PQntuples(res) != 1)
> > + {
> > + /* unsure because multiple (or no) pgbench_accounts found */
> > + partition_method = PART_UNKNOWN;
> > + partitions = 0;
> > + }
> >
> > Is it ever possible to have multiple pgbench_accounts considering we
> > have unique index on (relname, relnamespace) for pg_class?
>
> The issue is that it is not directly obvious which relnamespace will be
> used by the queries which rely on non schema qualified "pgbench_accounts".
>

It seems to me the patch already uses namespace in the query, so this
should not be a problem here.  The part of query is as below:
+ res = PQexec(con,
+ "select p.partstrat, count(p.partrelid) "
+ "from pg_catalog.pg_class as c "

This uses pg_catalog, so it should not have multiple entries for
"pgbench_accounts".


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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Feature request: binary NOTIFY
Next
From: Robert Haas
Date:
Subject: Re: block-level incremental backup