Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mPlkg-0003BU-Gn for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Sep 2021 13:12:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mPlke-0005js-Ur for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Sep 2021 13:12:00 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mPlke-0005jK-HQ for pgsql-hackers@lists.postgresql.org; Mon, 13 Sep 2021 13:12:00 +0000 Received: from mail-io1-xd2b.google.com ([2607:f8b0:4864:20::d2b]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mPlkZ-0000KR-LR for pgsql-hackers@postgresql.org; Mon, 13 Sep 2021 13:12:00 +0000 Received: by mail-io1-xd2b.google.com with SMTP id a22so11935140iok.12 for ; Mon, 13 Sep 2021 06:11:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Fleo+J+6CI3QMmNOjZn8J9U5BonlSDEcnNmiXNARWDU=; b=TWTYI0SpYL9iNqbuulU4wM3U8EAeqw0hlf+2vF0cuZQrJG+UyZ5qL0hfV+VmqQ7alw MFqsBgdlA+rmaatXm3JLNFLDoxGT3IBuHYluwUP3/8qYIFCe5kkHCUTeEAsz6UBXcCIs olyvSwXZvIT0J5lCO1Ad7lgUURPhf87TxUqIUa4rkD2J+STa5azxcbRgqgsQdUP+EPlp zzwi8ahpU0YA4YEoeLPhC9NDMDA7z/fxQEOtH/5wRwED4obbRf73jn2sLUQgM9c7L+JV UTrfJ7s+6Zo5BJPxYYogw3QNdabMhxzdlXlECmYeC1tFaVHYMeRMIha3Kl60y+BSPYpX /UMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Fleo+J+6CI3QMmNOjZn8J9U5BonlSDEcnNmiXNARWDU=; b=FyWRKQzCx/vLPRih0AFKXBaaSpyBLUx4D/c41uE/wILs5Q/OaiuPkdTsG1tclaLaS6 8nSfGaEzKwS/tWl10tnH7JORLSbaJlTUIY1PWeLvNicRgxFYsk4w/dsErAuxemf1/tHN EqFhFfOyYP7NTlB9kXFSrHXDHGIfrhrPu1EsRUBTYbHIlPYNzUB/gBb8Xv0uFlhmc2Dl 5NZSB8AgHgxNksZR8SePNrvFMib0hPW1mz0foUN54lo2mBpj8hm4NYX+TrX8FvTgYOtH 6ELVWzw7eErzFKJd5teoroCiP4Da7GTOgslyu+IIf4C6EjzFDFvonxQFGw0egG0QndEb yscw== X-Gm-Message-State: AOAM533k3pCfd6W3T57yBdmHLmMP15t6JijQgnPW01EasZbuA6DED+Uo esdPI3FdQZ00tq632O22UWCzWA== X-Google-Smtp-Source: ABdhPJwitDwH+QdzjT1W22A+J4TgBuZd3s52M+ZQrt4MyJh4TGfzSCK95IOg+jfkp0Y4nX0vAMDc2g== X-Received: by 2002:a02:7355:: with SMTP id a21mr9539957jae.53.1631538713739; Mon, 13 Sep 2021 06:11:53 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id b76sm4514062iof.17.2021.09.13.06.11.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Sep 2021 06:11:53 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 6DDCD800BCE; Mon, 13 Sep 2021 08:11:52 -0500 (CDT) Date: Mon, 13 Sep 2021 08:11:52 -0500 From: Justin Pryzby To: Pavel Stehule Cc: Tom Lane , Alvaro Herrera , Tomas Vondra , Daniel Gustafsson , Dean Rasheed , Stephen Frost , Surafel Temesgen , vignesh C , PostgreSQL Hackers Subject: Re: proposal: possibility to read dumped table's name from file Message-ID: <20210913131152.GO26465@telsasoft.com> References: <202107122259.n6o5uwb5erza@alvherre.pgsql> <3183720.1626131795@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Jul 28, 2021 at 09:28:17AM +0200, Pavel Stehule wrote: > Here is an updated implementation of filter's file, that implements syntax > proposed by you. Thanks. If there's any traction for this approach. I have some comments for the next revision, > +++ b/doc/src/sgml/ref/pg_dump.sgml > @@ -789,6 +789,56 @@ PostgreSQL documentation > > > > + > + > + > + > + Read objects filters from the specified file. > + If you use "-" as a filename, the filters are read from stdin. Say 'Specify "-" to read from stdin' > + The lines starting with symbol # are ignored. Remove "The" and "symbol" > + Previous white chars (spaces, tabs) are not allowed. These Preceding whitespace characters... But actually, they are allowed? But if it needs to be explained, maybe they shouldn't be - I don't see the utility of it. > +static bool > +isblank_line(const char *line) > +{ > + while (*line) > + { > + if (!isblank(*line++)) > + return false; > + } > + > + return true; > +} I don't think this requires nor justifies having a separate function. Either don't support blank lines, or use get_keyword() with size==0 for that ? > + /* Now we expect sequence of two keywords */ > + if (keyword && is_keyword(keyword, size, "include")) > + is_include = true; > + else if (keyword && is_keyword(keyword, size, "exclude")) > + is_include = false; > + else I think this should first check "if keyword == NULL". That could give a more specific error message like "no keyword found", > + exit_invalid_filter_format(fp, > + filename, > + "expected keyword \"include\" or \"exclude\"", > + line.data, > + lineno); ..and then this one can say "invalid keyword". -- Justin