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 1kMxe1-0000KE-9o for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Sep 2020 18:13:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kMxe0-0004Z0-8D for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Sep 2020 18:13:00 +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 1kMxdz-0004Yt-To for pgsql-hackers@lists.postgresql.org; Mon, 28 Sep 2020 18:13:00 +0000 Received: from mail-oi1-x243.google.com ([2607:f8b0:4864:20::243]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kMxdv-0000Y5-T2 for pgsql-hackers@lists.postgresql.org; Mon, 28 Sep 2020 18:12:59 +0000 Received: by mail-oi1-x243.google.com with SMTP id t76so2343178oif.7 for ; Mon, 28 Sep 2020 11:12:55 -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=s3/k700b2tq2e27hHOFtWpGxbSij/Bc57txCoZX0Bu4=; b=shEFnae+74HSuW1qd08deIQeEymv+zWcRI3G/Jfy+dSTOhQ8fN+G02OwkHXkEnisvi X44eZmCO5QBSHcEroBLX+PF3zz+2rUV6Kgcem9reM011MlVJbmEBxoT4XEFd2uw9FqOy s2Cj8y6vLaSONYkEFdGWhQ19wmaY3setlUaJGR6lJ52o8he/N2kebVjG7jA0OcOfHwXN Yj6+fgd4XrYdVhlO6xQ+GF9KVtNP4v2VHF5YI0jffwhUacfgXAghLhnjiFhssRc7w3CK N2WIgArZuO8cs6rpHwNOcbdXqm18WPcqzwz88+jHeUSWxvHxv5M1YJ93IE+xj0fVhoQA jseA== 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=s3/k700b2tq2e27hHOFtWpGxbSij/Bc57txCoZX0Bu4=; b=VL3bi9FOnrYdmTE4SyNof7ya+ivwrYd0nGlOYYAH7oPGz4PuB3evUvqxAZM/KQhDK+ F/hhJNrYWebXcJFCdaxDSWik6huocjff2f+4uZh8qxxqKBGmAyhMhGpJydCNGgaw3oN2 bs6yGWPJ/uMojnyqUT1I2g2+l6CxTQdry5GuFS1YOz6x5S4n8YDk7mh+y0/glnZ84bp/ oOV6pJaqMUp1JFhoj2pKloFz95Bh+16tfFZes62sKX07kuW4SJ4zEAKQSXTRldAEON0f iLUVfMh3VGyz90htLYWMEvtl4cz1zTWcPuGdfdh2hPer5ky5GnLn4AweqrSAdnspAGHb LFeg== X-Gm-Message-State: AOAM532zc+kvsv70WKfAu+ZXgmiYbNvwmmD1CM17slTT+6TWq1N5qeL+ hsmenvX4s6Vf90wWli1LsnjD4dS7xcytO9R7ijEUdrfItc1U6FQdXM5hNhpRXZBGgMyPXMXvmV3 PEz/IlAXhptE1ItJbcHoBehrmJDV2YSo2w6eWz4WSktw9557WAscuFd94B/c1rZjdH4g6YsMzmp XOx1p7/ls+D+yVvKRFVa7sAu9x/A== X-Google-Smtp-Source: ABdhPJyKOMg9PkFST5ov755PXMMyxb4DYV5GkBpHHP0O5x+1eP9K8LF2BpPMhdrN+ICmfkBl3nd8bg== X-Received: by 2002:a05:6808:1a:: with SMTP id u26mr93678oic.78.1601316772582; Mon, 28 Sep 2020 11:12:52 -0700 (PDT) Received: from ?IPv6:2600:1700:722:4630::43? ([2600:1700:722:4630::43]) by smtp.gmail.com with ESMTPSA id c7sm396891ots.20.2020.09.28.11.12.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 28 Sep 2020 11:12:51 -0700 (PDT) From: Andrew Dunstan X-Google-Original-From: Andrew Dunstan Subject: Re: BLOB / CLOB support in PostgreSQL To: Vladimir Sitnikov , PostgreSQL Hackers References: 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: <30a99a6e-5339-1daa-0eea-e42e72184ff6@2ndQuadrant.com> Date: Mon, 28 Sep 2020 14:12:50 -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: 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/28/20 9:46 AM, Vladimir Sitnikov wrote: > Let me please bump the thread. > > Just in case, I'm PgJDBC committer. > > PgJDBC receives requests to "support CLOB" from time to time, however, > I believe it is impossible without the support from the database. > To my best knowledge, the database does not have APIs for "streaming > large text data". > The only "streaming large binary data" API I know is LargeObject which > seems to be old-fashioned. > > I believe Java is not the only client that wants streaming access for > binary and text data. > > Here's a recent pull request to PgJDBC > https://github.com/pgjdbc/pgjdbc/pull/1892 where Andrew suggests to > add BLOB/CLOB support via bytea/text, > and apparently, Andrew is surprised that the database lacks BLOB/CLOB > support. I didn't at all say I was surprised. I said I didn't recall seeing  a call for what you're talking about, and indeed there has been very little. > > Any ideas on the way to proceed here? > I don't think it is right to implement Clob via text, especially in > case the database provides its own "large text with streaming" > datatype in the future. > > 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. > > I think your concerns are seriously misplaced. In the first place, what I have proposed is an optional behaviour, and it does not at all preclude other behaviour being made available in future, as well as the current behaviour which would remain the default. Furthermore, it's consistent with how the MySQL driver behaves, AIUI, and possibly others as well. That consistency is a major motivator for the work I've done. Do you suggest they should rip out their Clob interface until MySQL supports a streaming data type? But this is hardly the place for such arguments. To the best of my knowledge there is no concrete proposal for the type of data type / interface you suggest. I don't even have any very good idea what such a thing would look like. cheers andrew -- Andrew Dunstan https://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services