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 1kNKRj-0002Uq-RC for pgsql-hackers@arkaria.postgresql.org; Tue, 29 Sep 2020 18:33: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 1kNKRi-0006Ki-Q8 for pgsql-hackers@arkaria.postgresql.org; Tue, 29 Sep 2020 18:33:50 +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 1kNKRi-0006Kb-Fs for pgsql-hackers@lists.postgresql.org; Tue, 29 Sep 2020 18:33:50 +0000 Received: from mail-oo1-xc41.google.com ([2607:f8b0:4864:20::c41]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kNKRf-0004vh-I0 for pgsql-hackers@lists.postgresql.org; Tue, 29 Sep 2020 18:33:50 +0000 Received: by mail-oo1-xc41.google.com with SMTP id m25so1540044oou.0 for ; Tue, 29 Sep 2020 11:33:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=from:subject:to:references:autocrypt:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=ybBp5rplcIF/RLVcuGCJ8gULNwnrqjiRHUAaTuzYmSs=; b=xQYCRqZwz7b2Iixo40sz7pMjRp0tBtB/yjMfuxNNgsCs1RK6MhJ6l9WlshQv+UDUXI CtVHdb7GUMXfQW+B6xvcylSgE12inREcoxta/qfsoBPdWUaFkRX3jv3lEc7cD5ZJzwKg RptpbkfXVqur031Jnbn44rcLCDq2GPFJq1qyfD/GtGHIotLgZ1bQg5+fxMrbpjesQn8W +vPqWaZuIrU7IqYGsEP2DC/qVsFMoOLLMW35FITfXDuxjTU1lYZvbTebll/qKfZkdYYr C6QgSaLVRT90JQfZfawL4BmdyEjilP1TuRMAcU6sY18SIHMy4PUiubdPTXD37gyLmKUg TIKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:references:autocrypt:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=ybBp5rplcIF/RLVcuGCJ8gULNwnrqjiRHUAaTuzYmSs=; b=CVZYtnM4F6+1oYwtYx9zrpQOkJFA0VAXrl324aAIs8BEsx3px2WJEJDojxJOemoo57 Smo7N0qqW42mA/4zryJSSsMm26EP5Fgt8cqW1bw3YjD8T5tJiaPaIWPKnfuFeOV9UYT2 zFGw6/YtwC70RGqcf7IdrS1aGAbGL4rRgWxVqgbOylprz3qSwQ0Ols2KYxGyfWPv1z3z VCAw2pLSWnVlyK1pGJrx2XcrXDFdvOyXonraHo14YrbyDS231IPTSFK+xFE5FbzaAQXK xGW8EnqaCSnMJiQ17U/MSGU6Gpp1WJ0U1ENAXBsEIUVq4Frde4R9L5T9LIEax0JJLZY6 71tQ== X-Gm-Message-State: AOAM531rBy1G3nWdY7XlbRBYVi9TgB59qw3AcGISDIfgGK/61XnFF4pq ANdWkUctKaVk7zQcKiJk0Ps6lR2OWP6onc0OA84IyQyVi6wbnXAzpJn+EJJAtrWZItz83LOAWyP QBTPFhIluk9CASDa8Z9Lq78JFm8Z4UB07dOBnUVulYPmVJ49ExV+eRbSM23Eug+cpn3dahUnlvR pW1gc3Eqd1o2153qaTeRgxV1PKkw== X-Google-Smtp-Source: ABdhPJyWBKAVgJE0T6bn6ZD581kxdJQ0yv61qpODv3N4hg0PvlSkS76aZ8IgCXCHj1jqf6jzNu2Iaw== X-Received: by 2002:a4a:bb05:: with SMTP id f5mr5634419oop.5.1601404424189; Tue, 29 Sep 2020 11:33:44 -0700 (PDT) Received: from ?IPv6:2600:1700:722:4630::43? ([2600:1700:722:4630::43]) by smtp.gmail.com with ESMTPSA id w64sm1168670oig.31.2020.09.29.11.33.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 29 Sep 2020 11:33:43 -0700 (PDT) From: Andrew Dunstan X-Google-Original-From: Andrew Dunstan Subject: Re: BLOB / CLOB support in PostgreSQL To: Peter Eisentraut , Vladimir Sitnikov , PostgreSQL Hackers References: <6570918c-7776-d217-6e15-52e8006cf15f@2ndquadrant.com> Autocrypt: addr=andrew.dunstan@2ndQuadrant.com; prefer-encrypt=mutual; keydata= mQENBE7KWFkBCAClridxur2AIc7eW2AR7izbfp3EnNefie2HbLF0izW5Ik5UjX2HBXBx4syI gY6b0ugohXrr274+baoAlvSbq6cAoQuEVrk5IZFzt20b1Xkx65FwGSEj526yiKLocqkJceSq Xr9xcA5SGY+FZv441chh5SU92v4q6z+6LPpoHOh97ptAVXZYNTtU0LevyvD5lja0TzbvJm6C eFXitJfnm1pLEr0DGJCR/iUOl/N62Kh4855zZC7NHIjQHPOvV5Stz/l5ilDhvGVk+xkXFPys SjZoUr1rXhYLpiyi5sR0X9FHXT0KnGuz1F5ERO7ZTLSSQ6fJwPj6gOk9K+vvoKvoeql5ABEB AAG0L0FuZHJldyBEdW5zdGFuIDxhbmRyZXcuZHVuc3RhbkAybmRRdWFkcmFudC5jb20+iQFY BBMBAgBCAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgBYhBOQ+WEYd/Hy/RGkVpZn6f8tZ /DuBAhkBBQJd1pSYBQkSzqMsAAoJEJn6f8tZ/DuBJmEIAIVFBIC3qGqh+YTPVTkfowwxpHz0 tZSPjZ6GS/5y62kgoZrZOVXw+Rg2ceuMM3a+In/RRjTx4bembgYqRKgzXlDfiNBJeq5ioVuN H1faDKE2lm5a6QkRQ2JU6DKf60fqSJGP5LisCUr1V0wz6EnlO31ArrKtXCNB+yk0KDAS6o6I Ql4pkXpr+vq4iilwJmiJOqTBam0LmQE7ulYCCYU8Z6MkpiSl+dO7QSramcGyxauQRI3a7gcq dpo8Vrv3gFTQDeMYxk7cqZp08pIVH5XR0+LgBz4X84f59rA/VAKlC/r6CyEQk59rvDLxCMyP 2buoj51Z25N3MVghRDGcsU6mT7e5AQ0ETspYWQEIANGc4zQULOxhbqO2dyD51YhqCNRmm9oK Waqf+wmW4tpDe/VVcxAnNizd4LWCHfzpb5cHAtGkOPePMfzWVf6nvdF7d3eglbtf59+zG7O7 llV0xSSoFiieQBsrGvqDInXYX/4mRRXMtyhM353/tixC9RWLs1oofyYmCPPXXY7h9R7en3B8 BoVrRFcdzlIY/NFNhFGW/9dkEiGjgna2Rk6e15kln4ZvFBWUg23p93w/pqXcxY6+k/8TEk+C 4R+M6w7o2PLGOjdZ+kPiUcw5H85zf/yZJwQXzisXaNduwWB6Vads9YC9dj6kPR1c4VGRqAaY L++LAEOqrlvm2TvqQqZRtnEAEQEAAYkBJQQYAQIADwIbDAUCXdaUtAUJEs6jVQAKCRCZ+n/L Wfw7gQi5B/9sHbmRloZNCWWwZGm+O9iG/JGQxS0WWa4GaZqzqSTWOft2/gO0Bgag89r1djq4 PFgSZtzHvKQpqYz/7HkPrWh1jpcS83i/uYY1uyHXUUtpdEmn4buNObEtD0YNaJkGdhASsECq 6akw+u7WJYmAHs/SpR6ok6HqLw7JHDVc2h5dViLfTk0qrgDa7sq/LVMoJje5Ct/Ku3YaWAV6 YSmzoPP5BmPVFqP11OMQkCqurIu9vTLXKFWX623vCmqRDHJ6e5GCDHbH8USU+4wJBfPymZkd cA7NGm/mmWeJiWBFIDyjzYxrjku8ty9TZJVsaRXnS+OFQzXz9Eu2wTpKdHij46uY Message-ID: Date: Tue, 29 Sep 2020 14:33:42 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <6570918c-7776-d217-6e15-52e8006cf15f@2ndquadrant.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 9/29/20 10:26 AM, Peter Eisentraut wrote: > 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. > > So if I read this correctly what I have proposed is completely kosher according to the spec - it's the "fully materialized on the client" variant, just like the MySQL and MSSQL drivers. cheers andrew -- Andrew Dunstan https://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services