Skip site navigation (1) Skip section navigation (2)

Re: pg_restore ignore error patch

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: pg_restore ignore error patch
Date: 2004-04-10 09:03:54
Message-ID: Pine.LNX.4.58.0404101048130.2356@honfleur (view raw or flat)
Thread:
Lists: pgsql-patches
> > please find a small patch submission so that "pg_restore" ignores some sql
> > errors.
>
> Yeah, we've been talking about doing that for awhile.  But please define
> "some errors" --- what do you ignore exactly?

Connection errors are not ignored.

The error is triggered directly by the execute sql function, so it is hard
to know what is going on there. There are 3 instances. I've skipped the
"set session authorization" stuff, but 2 others are filtered.

A more complete implementation would allow to ignore errors on language
restoration or things like that, or initial cleanups... But that would
require to change the current code structure a lot, so as to avoid direct
exits... Moreover it does not look really necessary from my point of view.
I just aim at having direct "pg_restore" behave as "pg_restore|psql".

> + 	if (AH->n_errors)
> + 		/* translator: %s stands for "error" or "errors" */
> + 		fprintf(stderr, _("warning: %d %s ignored on restore\n"),
> + 				/* translator: in sentence warning: 123 errors ignored... */
> + 				AH->n_errors, AH->n_errors>1? _("errors"): _("error"));
>
> Please read the message style guidelines: the above goes directly
> against the advice for writing translatable messages.

Ok.

> Also, it might be wise to return a nonzero exit code when any errors are
> ignored.  I'm not sure about that, but it might be best to err on the
> side of caution...

Ok.

I'll resubmit.

-- 
Fabien Coelho - coelho(at)cri(dot)ensmp(dot)fr

In response to

pgsql-patches by date

Next:From: Andrew DunstanDate: 2004-04-10 11:26:22
Subject: Re: pg_restore ignore error patch
Previous:From: Fabien COELHODate: 2004-04-10 08:47:48
Subject: Re: pg_restore ignore error patch

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group