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 1kDvDV-0006aW-Fu for pgsql-hackers@arkaria.postgresql.org; Thu, 03 Sep 2020 19:48:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kDvDS-0000W2-EE for pgsql-hackers@arkaria.postgresql.org; Thu, 03 Sep 2020 19:48:14 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kDvDR-0000Vv-V6 for pgsql-hackers@lists.postgresql.org; Thu, 03 Sep 2020 19:48:14 +0000 Received: from mail-io1-xd2c.google.com ([2607:f8b0:4864:20::d2c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kDvDK-0002uQ-Rc for pgsql-hackers@postgresql.org; Thu, 03 Sep 2020 19:48:12 +0000 Received: by mail-io1-xd2c.google.com with SMTP id j2so4615328ioj.7 for ; Thu, 03 Sep 2020 12:48:06 -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=eEycv3M0HWVnw/Vnar1bP9l1sSpIUP5Au2H3Ejvdnck=; b=nCfSybT6pZCKeMSgUKJl+8xkNBXF283zMPzihg05Kue8dxzYUTsmEJfUyO5BXM+yEj 4QoXr5bxuZu+WHOCMUcyONV5Tm4cLWl38t7jXu+vvrDd7S/Q8jgiS/JEM08q9hsBBXZ9 8SjCm53UPaZfqNEB9ymtKc/WsvXgmkILY7wJKnINS4Mtnc6OoTQn/ETNGHOzs9G17E1F tSVNZkQkjygJOyp9bbqArZFyP697QHPgWFGJkGp1Wosf5LVwxoL+7PQ1bPiIPC2WcLoX 7KbHkzUdG7SDaqrPCSddDJbb3dFPs8+PAC4QUYkUtDTf0CY0VnUexVXnvWa37Fnf8BpI sYFA== 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=eEycv3M0HWVnw/Vnar1bP9l1sSpIUP5Au2H3Ejvdnck=; b=kl529Z/WdLjWR/8iecAgm3r+a7PvvHnhJvxPLUkuHY+DzpsplsXfr/qwor6Ko7JAkk FjUyolTcnc3yFtt0e4uaUQT/Xzj9IOXS6vVsFQzLCdjcvT4w5maN0s+p8P6n9WBSrFJ7 S+Jn86pFK2UKYoWbJzxXf+Fy6PooW9nBdINUJ7BP+S4e4WcPXFCXtbU4JyIMnGWB59a+ YJ7HdEwkYGbu+QZSMaj2E2mm2h9H3GCopfdrJ/uKc7THVVyMKh5Esnzys6eylRHa9thV UNSvcunlzmM5Pg5oExytO+CIAHi29d8b+b8jJZW9YpACe/mKFf30p5Uazd+pxl0uBqTs A7gQ== X-Gm-Message-State: AOAM5319HzYtEjMPA3s+ipQwnTdvjlxO8xlZ5iErT6tFF8CNvKOjNuHI ZA9ovkctgKlz05FPATZBbKIXqw== X-Google-Smtp-Source: ABdhPJybF9TTOcrtQPsXaUAQWjuo5mi5eVHKxMFVSGLmIi7htolNhDyNE99y9sNGXifdwJkvCCcHYA== X-Received: by 2002:a05:6638:587:: with SMTP id a7mr4734877jar.72.1599162485137; Thu, 03 Sep 2020 12:48:05 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id k16sm1686722ioc.15.2020.09.03.12.48.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Sep 2020 12:48:03 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 82AA48004CC; Thu, 3 Sep 2020 14:48:02 -0500 (CDT) Date: Thu, 3 Sep 2020 14:48:02 -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: <20200903194802.GP29760@telsasoft.com> References: <20200529182514.GL17850@telsasoft.com> <20200608212957.GB22473@telsasoft.com> <20200609223042.GF26811@telsasoft.com> <20200701212452.GF4107@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 Sun, Jul 05, 2020 at 10:08:09PM +0200, Pavel Stehule wrote: > st 1. 7. 2020 v 23:24 odesílatel Justin Pryzby napsal: > > > 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: > > 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); > > 63 bytes is max effective identifier size, but it is not max size of > identifiers. It is very probably so buff with 1024 bytes will be enough for > all, but I do not want to increase any new magic limit. More when dynamic > implementation is not too hard. Maybe you'd want to use a StrInfo like recent patches (8f8154a50). > Table name can be very long - sometimes the data names (table names) can be > stored in external storages with full length and should not be practical to > require truncating in filter file. > > For this case it is very effective, because a resized (increased) buffer is > used for following rows, so realloc should not be often. So when I have to > choose between two implementations with similar complexity, I prefer more > dynamic code without hardcoded limits. This dynamic hasn't any overhead. -- Justin