Re: Template for schema? (as opposed to databases)

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Dominique Devienne <ddevienne(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Template for schema? (as opposed to databases)
Date: 2022-01-11 16:30:00
Message-ID: CAKFQuwZi4LnmC4XzABS7GiWkx-dVrNf=YzZiPwZq3gb_B1YGGQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tuesday, January 11, 2022, Dominique Devienne <ddevienne(at)gmail(dot)com>
wrote:
>
> This means the template-schema name is part of the DDL for the schema, and
> a clone would need to use its own search-path, not the original.
>

This is your major limitation. You are required to create new objects from
code and cannot leverage any kind of copy of existing objects. Unless the
test database need only be three schemas always - then the schema can be
identical because you can place them into different databases.

> Please do note this needs to be done from a libpq client, which has no
> direct access to the server (i.e. cannot use dump/restore solutions).
>

PQexec and put the entire script into a single string. That seems like the
fastest possible way to create new objects (see the first point).

Beyond that there is too little detail to provide suggestions. I would
observe that for testing the meaningful values of N are 1 and 2. Having a
setup where N = 5 is not materially different than the N = 2 case (usually).

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Francisco Olarte 2022-01-11 16:38:03 Re: Template for schema? (as opposed to databases)
Previous Message Dominique Devienne 2022-01-11 16:09:50 Template for schema? (as opposed to databases)