Re: possibility to specify template database for pg_regress

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: possibility to specify template database for pg_regress
Date: 2017-02-11 06:03:27
Message-ID: CAFj8pRACqiB0qydd8_YWxJt9XZkYqX4dNmWOXDnWK2u1XuRg+A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

2017-02-10 6:00 GMT+01:00 Michael Paquier <michael(dot)paquier(at)gmail(dot)com>:

> On Thu, Feb 9, 2017 at 5:13 AM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
> wrote:
> > here is a patch
>
> Thanks.
>
> - for (sl = dblist; sl; sl = sl->next)
> - create_database(sl->str);
> + if (templatelist != NULL)
> + {
> + _stringlist *tl;
> +
> + for (sl = dblist, tl = templatelist; sl; sl = sl->next, tl
> = tl->next)
> + {
> + if (tl != NULL)
> + create_database(sl->str, tl->str);
> + else
> + {
> + fprintf(stderr, _("%s: the template list is
> shorter than database list\n"),
> + progname);
> + exit(2);
> + }
> + }
> + }
> + else
> + for (sl = dblist; sl; sl = sl->next)
> + create_database(sl->str, "template0");
> There is one problem here: if the length of the template list is
> shorter than the database list, databases get halfly created, then
> pg_regress complains, letting the instance in a half-way state. I
> think that you had better do any sanity checks before creating or even
> dropping existing databases.
>

here is new update - check is done before any creating

Regards

Pavel

> --
> Michael
>

Attachment Content-Type Size
pg_regress-template-option-02.patch text/x-patch 3.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2017-02-11 06:41:30 Re: Parallel bitmap heap scan
Previous Message Amit Kapila 2017-02-11 04:22:34 Re: Parallel Index Scans