Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jCNHB-00006o-Lb for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Mar 2020 12:49:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jCNHA-0001MR-H1 for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Mar 2020 12:49:24 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jCNHA-0001Lc-52 for pgsql-hackers@lists.postgresql.org; Thu, 12 Mar 2020 12:49:24 +0000 Received: from mail-qv1-xf42.google.com ([2607:f8b0:4864:20::f42]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jCNH7-0006DL-HV for pgsql-hackers@postgresql.org; Thu, 12 Mar 2020 12:49:22 +0000 Received: by mail-qv1-xf42.google.com with SMTP id c28so2493944qvb.10 for ; Thu, 12 Mar 2020 05:49:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=59BH6oNpde2eNdqVlEIpY1zoOV7p1BktHhOQTSCakdY=; b=jNKnG5SHoSIXRumMgxAcm8mIdknl+OTiBBzY9xHAdC8/OJlWiGZtcZVIhJU2jT43DR /5Kzf5nyHnYyRpL6cEsAkAC9p4F5HSNYLS6nJks+0ShSKBKFuEp4zoqHUxZE0XBfzJjf GrR1xrPf8SuWnpptEVFykkOWUQ30+GG4xHAtPD/1AjsDJmC2oyW7YA/Ak96qyt4eL8i1 pNqTRuXySxehr3fvSr7Bbg0d1UIblz7BI5bo+QsbOptiaxRewhYgCVrPfq/3skTU/R0A macCf1zbRhFiFZMXoqc0v7mb+RBsMo9hTwM0FHCTMld7MhBnfjWvamWgtKMPeeR5Jx7T wwoQ== 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:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=59BH6oNpde2eNdqVlEIpY1zoOV7p1BktHhOQTSCakdY=; b=r30sbyE1T7xNqv5YIhl2fkIhrvN4qahs1sDKjXnDqYgPoxBJaJ6oloKx37Hf64SY3r OEZ6L2ACZuN85aDeBZ056byExSwq4x6TKIyaIlLxCuonbUUP56HctObXMkP+RfWh1Kja A1tKUmczKjG8bE0QSokQRkEsSoaMEx4wJsvqIBc2Py3wTIbXYgSXtlAhXqWwSVXnqHCn bLIfKuaevLL4C4RZSanoWQfIf0ylCWqtPOKfwXGqa09I3zzXpcDmHjvDQT5HD2DzldzX aD7aLM/TY+P6NO9NntBZD27t1oE20oS4P9E57IpbWb4guWMol4HxenG+68K9An7LE8sl WRGw== X-Gm-Message-State: ANhLgQ1lc2h4oMIc0P6W/AxHEHJCd+NCHZp0b3Aodrp6WPSo6sKDfBmO 51vpOyJIDpYL3VzKURF4zJQOAw== X-Google-Smtp-Source: ADFU+vtvJrMVjIPnZzdosIKPJNchSdzINGt7R62QsCEg0RZVG3B5GIqphNGTfQplw1zX9Si13wKTww== X-Received: by 2002:a05:6214:427:: with SMTP id a7mr1238292qvy.10.1584017360469; Thu, 12 Mar 2020 05:49:20 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([179.56.30.174]) by smtp.gmail.com with ESMTPSA id f3sm17409176qtv.51.2020.03.12.05.49.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Mar 2020 05:49:19 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id F0985300AB4; Thu, 12 Mar 2020 09:49:17 -0300 (-03) Date: Thu, 12 Mar 2020 09:49:17 -0300 From: Alvaro Herrera To: Justin Pryzby Cc: Tom Lane , pgsql-hackers@postgresql.org, Fabien COELHO , David Steele , "Bossart, Nathan" , Thomas Munro Subject: Re: pg11+: pg_ls_*dir LIMIT 1: temporary files .. not closed at end-of-transaction Message-ID: <20200312124917.GA8369@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200312121156.GB29065@telsasoft.com> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Nitpick: please see c4dcd9144ba6. > From: Justin Pryzby > Date: Wed, 11 Mar 2020 10:09:18 -0500 > Subject: [PATCH] SRF: avoid leaking resources if not run to completion > > Change to return a tuplestore populated immediately and returned in full. > > Discussion: https://www.postgresql.org/message-id/20200308173103.GC1357%40telsasoft.com I wonder if this isn't saying that the whole value-per-call protocol is bogus, in that it seems impossible to write a useful function with it. Maybe we should add one final call with a special flag "function shutdown" or something, so that these resources can be released if the SRF isn't run to completion? -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services