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 1kNGai-0008CH-1g for pgsql-hackers@arkaria.postgresql.org; Tue, 29 Sep 2020 14:26:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kNGaf-00015f-4M for pgsql-hackers@arkaria.postgresql.org; Tue, 29 Sep 2020 14:26:49 +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 1kNGae-00015V-7i for pgsql-hackers@lists.postgresql.org; Tue, 29 Sep 2020 14:26:48 +0000 Received: from wforward4-smtp.messagingengine.com ([64.147.123.34]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kNGaZ-0002tl-Tu for pgsql-hackers@lists.postgresql.org; Tue, 29 Sep 2020 14:26:47 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailforward.west.internal (Postfix) with ESMTP id 330AA12AB; Tue, 29 Sep 2020 10:26:40 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Tue, 29 Sep 2020 10:26:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=tqTNnYj6v6lm7NkAGBTqpenEHBS0HFLFDFWUO1Eoh 1k=; b=NrcojooB4u1TplPAm79dquXy05RyKVqqxB/2aspsknwmmThfm0j/QVo/n eNXeaJa6rTJV76STy7lu1fhjM+v4C66FlKpY6dJX5ItLcZHKL3Oe6F49XgXMIOh9 GbYpTcWRMNSKnYohybxnVCOvrjwfuwDn2gEsRBVM5JHxMUvuknNGPDr0RlxdmiVB lvODIAFWeKiHznxZPVwbU533TcfShu8wUsCbXsUUL7BbCDgufuM8990x3TK6R0Ak 36i2nVWiq9hiyeJyGA1dU0pinR7aBWT2IOgMy2y84+/mao/iyl1XBB4M6W8LqFpZ OIOV17Iqtl4gdHX8YUNg/eqKf1O+Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdekgdejkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefuvfhfhfhokffffgggjggtgfesthekredttdefjeenucfhrhhomheprfgvthgv rhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdrvghishgvnhhtrhgruhhtsedvnhguqh hurggurhgrnhhtrdgtohhmqeenucggtffrrghtthgvrhhnpeelffffteffjeefhfehffev keeiteeikedufeffhfehveeilefhtefhgeefudehtdenucffohhmrghinhepvdhnughquh grughrrghnthdrtghomhenucfkphepkeejrddujeejrdeigedrudeludenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpvghtvghrrdgvihhsvg hnthhrrghuthesvdhnughquhgrughrrghnthdrtghomh X-ME-Proxy: Received: from april.pezone.net (p57b140bf.dip0.t-ipconnect.de [87.177.64.191]) by mail.messagingengine.com (Postfix) with ESMTPA id 15DEC306467D; Tue, 29 Sep 2020 10:26:38 -0400 (EDT) Subject: Re: BLOB / CLOB support in PostgreSQL To: Vladimir Sitnikov , PostgreSQL Hackers References: From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: <6570918c-7776-d217-6e15-52e8006cf15f@2ndquadrant.com> Date: Tue, 29 Sep 2020 16:26:37 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-09-28 15:46, Vladimir Sitnikov wrote: > The concerns to avoid "Clob maps to text" could be: > a) Once the behavior is implemented, it is hard to change. That is > applications would rely on it (and it becomes a defacto standard), and > it would be hard to move to the proper "text with streaming API" datatype. > b) If we make «clob is text», then people might start using > update/substring APIs (which is the primary motivation for Clob) without > realizing there’s full value update behind the scenes. Currently, they > can use setString/getString for text, and it is crystal clear that the > text is updated fully on every update. When we added TOAST, we made the explicit decision to not add a "LONG" type but instead have the toasting mechanism transparent in all variable-length types. And that turned out to be a very successful decision, because it allows this system to be used by all data types, not only one or two hardcoded ones. Therefore, I'm very strongly of the opinion that if a streaming system of the sort you allude to were added, it would also be added transparently into the TOAST system. The JDBC spec says """ An implementation of a Blob, Clob or NClob object may either be locator based or result in the object being fully materialized on the client. By default, a JDBC driver should implement the Blob, Clob and NClob interfaces using the appropriate locator type. An application does not deal directly with the locator types that are defined in SQL. """ (A "locator" in SQL is basically what you might call a streaming handle.) So yes, this encourages the implementation of locators. But it also specifies that if you don't have locators, you can implement this using non-large-object types. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services