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 1jqkE0-0002gS-3V for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Jul 2020 21:25:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jqkDy-0000No-QK for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Jul 2020 21:24:58 +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 1jqkDy-0000Ng-FZ for pgsql-hackers@lists.postgresql.org; Wed, 01 Jul 2020 21:24:58 +0000 Received: from mail-io1-xd29.google.com ([2607:f8b0:4864:20::d29]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jqkDv-00021C-Js for pgsql-hackers@postgresql.org; Wed, 01 Jul 2020 21:24:57 +0000 Received: by mail-io1-xd29.google.com with SMTP id c16so26621009ioi.9 for ; Wed, 01 Jul 2020 14:24: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:content-transfer-encoding:in-reply-to :user-agent; bh=e9NdyRAS2JISlirOsXySD+wr1lVRhNxYdnuI7UrCrkE=; b=UoLMYnPlMuj5F6yt8WW7lMO7JeY2ZpNyn3FxBSdngYO1w9HbQb0GqoYlHW8j0LLRFN 2M+zDpE9OsKTDNwPEh//+H28BIcHvjdCafsz6uDyT58jKQbOI6C5p/IrJv8+qF2XouWS ifmw1NvLyZh+GL1gJfRVPM+YVVU9Cu6He5m9TSgHkcuVu9GS50xIm7EyWuaM9cZugfiz W0qgKQIWCwOIyY5zpTY6+/1JZUGz4EsIka+Bg51Q1OBDtIqD2reKBGMGzCXBBtktJf+1 8UW/Uv+NgLzyDs+GfCTy/TbdtUU9xcTzEd2uvnds552+E4WqE93DaLCsPZpdtZ5Pzr/9 N1Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=e9NdyRAS2JISlirOsXySD+wr1lVRhNxYdnuI7UrCrkE=; b=YiMTjA+iAAl2Sspz5Cc51zo4t6o7Km2TULmETFwJO9nxVsxxR8Vz7uQYnHbOuScsYP f2X+3PPbw8PAPdjIJwHOdZSEE4pnWz57dF9TTNPJ0DAHbiFCc/fjQlzPOpR7YxFvO/rP kVKZfeQbmv8PO4dTItgfeguTCJOyAYkU4+qaPl5gdUAHoN2HwewlF0OZprUKc4oCPA0d ck9oP7D5lhLsK2/syNspWZSO1R9fEulWRHsq/mU3V0Z44lSDfEl4zBHj6ikfqhf6WI/L TY70C9LoccyrT57tvCnCMH+aRa+zgFtn0ZTsrJ/mGuskW+eaSkGz2N6ZoffV+4Gqcz/e s9Tg== X-Gm-Message-State: AOAM532KMOo583K5Bagc3UWgNg81mEnSzYT1qjP1dvAg9Sz9qDoCb1CI V9nMuUBItKISjzcxr9PQ3eUjJw== X-Google-Smtp-Source: ABdhPJxkqsdTSRpcPVaU4ukYtMk08H7Lj0xjOSXZxvWwG23O1BhvYTNs2stgut06Ai1Io8f4z/uIOw== X-Received: by 2002:a05:6602:21c7:: with SMTP id c7mr4292212ioc.1.1593638694065; Wed, 01 Jul 2020 14:24:54 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id y8sm3829843ilq.21.2020.07.01.14.24.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Jul 2020 14:24:53 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 696E280015B; Wed, 1 Jul 2020 16:24:52 -0500 (CDT) Date: Wed, 1 Jul 2020 16:24:52 -0500 From: Justin Pryzby To: Pavel Stehule Cc: pgsql-hackers@postgresql.org Subject: Re: proposal: possibility to read dumped table's name from file Message-ID: <20200701212452.GF4107@telsasoft.com> References: <20200529182514.GL17850@telsasoft.com> <20200608212957.GB22473@telsasoft.com> <20200609223042.GF26811@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, Jun 11, 2020 at 09:36:18AM +0200, Pavel Stehule wrote: > st 10. 6. 2020 v 0:30 odesílatel Justin Pryzby napsal: > > > + /* ignore empty rows */ > > > + if (*line != '\0') > > > > Maybe: if line=='\0': continue > > We should also support comments. Comment support is still missing but easily added :) I tried this patch and it works for my purposes. Also, your getline is dynamically re-allocating lines of arbitrary length. Possibly that's not needed. We'll typically read "+t schema.relname", which is 132 chars. Maybe it's sufficient to do char buf[1024]; fgets(buf); if strchr(buf, '\n') == NULL: error(); ret = pstrdup(buf); In any case, you could have getline return a char* and (rather than following GNU) no need to take char**, int* parameters to conflate inputs and outputs. I realized that --filter has an advantage over the previous implementation (with multiple --exclude-* and --include-*) in that it's possible to use stdin for includes *and* excludes. By chance, I had the opportunity yesterday to re-use with rsync a regex that I'd previously been using with pg_dump and grep. What this patch calls "--filter" in rsync is called "--filter-from". rsync's --filter-from rejects filters of length longer than max filename, so I had to split it up into multiple lines instead of using regex alternation ("|"). This option is a close parallel in pg_dump. -- Justin