On Thu, Jul 17, 2025 at 03:46:41PM +0530, Mahendra Singh Thalor wrote:
> On Wed, 16 Jul 2025 at 05:50, Noah Misch <noah@leadboat.com> wrote:
> > On Thu, Jul 10, 2025 at 12:21:03AM +0530, Mahendra Singh Thalor wrote:
> > > On Wed, 9 Jul 2025 at 02:58, Noah Misch <noah@leadboat.com> wrote:
> > > > On Fri, Apr 04, 2025 at 04:11:05PM -0400, Andrew Dunstan wrote:
> > > > > +/*
> > > > > + * get_dbnames_list_to_restore
> > > > > + *
> > > > > + * This will mark for skipping any entries from dbname_oid_list that pattern match an
> > > > > + * entry in the db_exclude_patterns list.
> > > > > + *
> > > > > + * Returns the number of database to be restored.
> > > > > + *
> > > > > + */
> > > > > +static int
> > > > > +get_dbnames_list_to_restore(PGconn *conn,
> > > > > + SimpleOidStringList *dbname_oid_list,
> > > > > + SimpleStringList db_exclude_patterns)
> > > > > +{
> > > > > + int count_db = 0;
> > > > > + PQExpBuffer query;
> > > > > + PGresult *res;
> > > > > +
> > > > > + query = createPQExpBuffer();
> > > > > +
> > > > > + if (!conn)
> > > > > + pg_log_info("considering PATTERN as NAME for --exclude-database option as no db connection
whiledoing pg_restore.");
> > > >
> > > > When do we not have a connection here? We'd need to document this behavior
> > > > variation if it stays, but I'd prefer if we can just rely on having a
> > > > connection.
> > >
> > > Yes, we can document this behavior.
> >
> > My review asked a question there. I don't see an answer to that question.
> > Would you answer that question?
>
> Example: if there is no active database, even postgres/template1, then
> we will consider PATTEREN as NAME. This is the rare case.
> In attached patch, I added one doc line also for this case.
If I change s/pg_log_info/pg_fatal/, check-world still passes. So no test is
reaching the !conn case. If one wanted to write a test that reaches the !conn
test, how would they do that?