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 1m3JAD-0008Ti-By for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Jul 2021 14:13:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m3JAB-0000vF-KM for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Jul 2021 14:13:31 +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 1m3JAB-0000v7-7x for pgsql-hackers@lists.postgresql.org; Tue, 13 Jul 2021 14:13:31 +0000 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1m3JA6-0007XA-QW for pgsql-hackers@postgresql.org; Tue, 13 Jul 2021 14:13:30 +0000 Received: by mail-ej1-x629.google.com with SMTP id gb6so41741108ejc.5 for ; Tue, 13 Jul 2021 07:13:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=KbnJ6QwgVzCv60Ix2B8gVHlPx6enBkHEhz7N+6rkuQo=; b=vTiP9ZP/Wz5Ss+CPmU2bTcecDHjvGEIzeOF5ctzGx1MbEjrHolwxIA4gRwfk4pZTh9 lHLwcL9Aw0fZVUZMSDA0lcEX3utLmgOUh+ZuKr15Xqi9iSWwWRzxxsFSXJxQQ1tkpXMs nAGkocbu31htlj8/f+04trYbnHjkyBFkZNhSOIRv9QFAc1kvWrx0d79Qsp3Aj/MbHhNn dYR0QPLXgiuP3acO/iTqaLS/5pKRb/ezAID/o8oYJU8ILck4IY9ArTiDuT+lQ5Ou0I4P c1urallZ2ZRdD5NQvvWokhJh8XCWjEQJbppuxC0jvgg3+lNbnM93fvN10oxeyHk2qH+a HWKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=KbnJ6QwgVzCv60Ix2B8gVHlPx6enBkHEhz7N+6rkuQo=; b=kAr4f96A2/LmwO3m+UeOoeB/oyLIlSiVlvSk9TyieOMl890k+79To24Lp7Ggr19C9f nKFRLDz1y0A72hrVqo/lwLjZboUfOP9569g7RVNNr5X5yqDh2/Z3kd/NQOajytgxmKhd csQNWvbwnS1YHXXV99FBG7ETtzp8D4tDM5f/JnPtN4VWkDsoZ901nYwkydj3B+f542+D Cet3sPt63xZFoUmgX4VZub3azQJshDUS2yXS8r58qVjTjN58cLYPeNufN0CHFt4oEfgR 8W+RdmrskDFlwnQz450VbUzgCegIvwBNFyLhpjU72SJoOPgSA08VO4atMr3ZF5EHQmTN Ry9g== X-Gm-Message-State: AOAM532No/wBo2Y+8wTfKBzs+GdDnPm4ZWKnmSEeEb4n8ptNFr51x0gk bgqUJZWquN9an5PGhAJrWKgqi2yi0YioA0S0xDJ56bhKJzkwPC7LT4T/R9NkW1UXpL9xDjxsJ7A d4/T+RjmymGAyh27U5HLeitpBZfJ2/y64HVoq6yUevfPVLUHClbS1soWbTBKIWNTmGlyIB6Ym8U a1sg3OI8N46CkikMw5gHEeEXwJh+pmnPUFQhwF/El5S87f+juk2bY3j8B92uQGxqsKuUGs6N3AV MByVhQEclVHfxj5cMX9TTPDF7gYALD2LNaO3g== X-Google-Smtp-Source: ABdhPJw0JI/AuTaq0EcX0t2f0+iOaQx5F+cIFQlHPKaicynLIGHafInJZUDY33bJp+RBiTTr6qRm5g== X-Received: by 2002:a17:906:4a05:: with SMTP id w5mr5827942eju.2.1626185604886; Tue, 13 Jul 2021 07:13:24 -0700 (PDT) Received: from [10.137.0.18] (static-84-42-175-93.net.upcbroadband.cz. [84.42.175.93]) by smtp.gmail.com with ESMTPSA id f5sm8026292ejj.45.2021.07.13.07.13.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Jul 2021 07:13:24 -0700 (PDT) Subject: Re: proposal: possibility to read dumped table's name from file To: Stephen Frost , Tom Lane Cc: Alvaro Herrera , Daniel Gustafsson , Pavel Stehule , Justin Pryzby , Dean Rasheed , Surafel Temesgen , vignesh C , PostgreSQL Hackers References: <202107122259.n6o5uwb5erza@alvherre.pgsql> <3183720.1626131795@sss.pgh.pa.us> <20210713134013.GF20766@tamriel.snowman.net> From: Tomas Vondra Message-ID: <2caf1efb-359d-7720-9d6e-88efdaaf55dd@enterprisedb.com> Date: Tue, 13 Jul 2021 18:14:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210713134013.GF20766@tamriel.snowman.net> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 7/13/21 3:40 PM, Stephen Frost wrote: > Greetings, > > * Tom Lane (tgl@sss.pgh.pa.us) wrote: >> Alvaro Herrera writes: >>> [1] your proposal of "[+-] OBJTYPE OBJIDENT" plus empty lines allowed >>> plus lines starting with # are comments, seems plenty. Any line not >>> following that format would cause an error to be thrown. >> >> I'd like to see some kind of keyword on each line, so that we could extend >> the command set by adding new keywords. As this stands, I fear we'd end >> up using random punctuation characters in place of [+-], which seems >> pretty horrid from a readability standpoint. > > I agree that it'd end up being bad with single characters. > The [+-] format is based on what rsync does, so there's at least some precedent for that, and IMHO it's fairly readable. I agree the rest of the rule (object type, ...) may be a bit more verbose. >> I think that this file format should be designed with an eye to allowing >> every, or at least most, pg_dump options to be written in the file rather >> than on the command line. I don't say we have to *implement* that right >> now; but if the format spec is incapable of being extended to meet >> requests like that one, I think we'll regret it. This line of thought >> suggests that the initial commands ought to match the existing >> include/exclude switches, at least approximately. > > I agree that we want to have an actual config file that allows just > about every pg_dump option. I'm also fine with saying that we don't > have to implement that initially but the format should be one which can > be extended to allow that. > I understand the desire to have a config file that may contain all pg_dump options, but I really don't see why we'd want to mix that with the file containing filter rules. I think those should be separate, one of the reasons being that I find it desirable to be able to "include" the filter rules into different pg_dump configs. That also means the format for the filter rules can be much simpler. It's also not clear to me whether the single-file approach would allow filtering not supported by actual pg_dump option, for example. >> Hence I suggest >> >> include table PATTERN >> exclude table PATTERN >> >> which ends up being the above but with words not [+-]. > Work for me. > Which ends up inventing yet-another-file-format which people will end up > writing generators and parsers for. Which is exactly what I was arguing > we really should be trying to avoid doing. > People will have to write generators *in any case* because how else would you use this? Unless we also provide tools to manipulate that file (which seems rather futile), they'll have to do that. Even if we used JSON/YAML/TOML/... they'd still need to deal with the semantics of the file format. FWIW I don't understand why would they need to write parsers. That's something we'd need to do to process the file. I think the case when the filter file needs to be modified is rather rare - it certainly is not what the original use case Pavel tried to address needs. (I know that customer and the filter would be generated and used for a single dump.) My opinion is that the best solution (to make both generators and parsers simple) is to keep the format itself as simple as possible. Which is exactly why I'm arguing for only addressing the filtering, not trying to invent a "universal" pg_dump config file format. > I definitely feel that we should have a way to allow anything that can > be created as an object in the database to be explicitly included in the > file and that means whatever we do need to be able to handle objects > that have names that span multiple lines, etc. It's not clear how the > above would. As I recall, the proposed patch didn't have anything for > handling that, which was one of the issues I had with it and is why I > bring it up again. > I really don't understand why you think the current format can't do escaping/quoting or handle names spanning multiple lines. The fact that the original patch did not handle that correctly is a bug, but it does not mean the format can't handle that. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company