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 1kNRuO-0003FC-A2 for pgsql-hackers@arkaria.postgresql.org; Wed, 30 Sep 2020 02:31:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kNRuM-00043c-FQ for pgsql-hackers@arkaria.postgresql.org; Wed, 30 Sep 2020 02:31:54 +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 1kNRuL-00043V-VX for pgsql-hackers@lists.postgresql.org; Wed, 30 Sep 2020 02:31:54 +0000 Received: from esa18.fujitsucc.c3s2.iphmx.com ([216.71.158.38]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kNRuI-0005Z4-0h for pgsql-hackers@lists.postgresql.org; Wed, 30 Sep 2020 02:31:53 +0000 IronPort-SDR: Zz9uiSIiwKmfNy79b+24Gob6vHdx12p4rW5Sg5KIrLsPVj/z6I0A+obD7Mc2QrLmSdI90DvTvZ iCaUKq+E6Ut3lbIZKALe6md0vwtjG3OoaPNvVi2tdmv52MldFupFkbKHRmSPcUc6xRlrt/71Fe 5PE1T8zog4h5DkIQdm4on4lZ95Ie1sbIVXdnyw3UbZmkqXXUUP6VETUPk9EmeaIDinBz/9xQ4K FBFLOoCCx2IHV9opsxsO8znd5DrMg9og7pEnK4X7/mx4yhV3nSoPO2GNFYg2pD+lVUmPcd5b7p KkQ= X-IronPort-AV: E=McAfee;i="6000,8403,9759"; a="19054942" X-IronPort-AV: E=Sophos;i="5.77,320,1596466800"; d="scan'208,217";a="19054942" Received: from mail-sg2apc01lp2058.outbound.protection.outlook.com (HELO APC01-SG2-obe.outbound.protection.outlook.com) ([104.47.125.58]) by ob1.fujitsucc.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Sep 2020 11:31:44 +0900 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B617CNCEuY7tDr1aX8RldXvc4J2hpLOvrXPv+ByVd2Grpem0ZfHWNmlVdh2gFJ563NWreB1WdMSJhEmLNAUMXUGppJRkanoJ7k25bs3MAUKxNlS3rLyL3uoh/WoDZ3m1YeA8DtR/nJTipae9RT/Gdftg19pFDnovbF8+DX8VDke45IC6R3nw0txhE/QVpw3d6ySuN+5LmWebVQ6yRT93FavZY+jImmLjY4qpSJJ+rw9FpXQyH8vsw4NEOOh9GDXZDkEeB1Nw8UGEVQGo85xP/noIn18WPoSDLscZbNNPc4IP6bmyRw0eXt0qQ48dRC5ECS5XN8D8/get4CW76jJaHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/J4lAlcbWt4r+kUeIPrU34LL+wt0h/21xR9OYkOa5Ww=; b=TbftMJduS1iVmFOB6cyY/Pbwfqi+d8DqQkzlELuL0v5NMZAV8S8JkkjFSC1WqN6mGpHsMeG0I3dpj5GgZXGeWoZzfTZd8/9/HampdszI7KWL9sCavy68jV5NZUm3RSVJ7pD1fc0yuRKlAAtaQ0M2iKrYs1pLcRQmo5SBnymwDCIHhgHelbC/MnKTF9SqtalbRaLvCVm4r+eG7/JSwQ1ZljAv5faMfdU3bRUGcEjpJll0VFzUkYKVTf2ZezeZi/NZxBZGtui1QgAmHULcC4eCbpsp6IasP+Q/+xDo3s8ZMrTO9rNRc8hbHbHchxblSWSWXAdrpDS4n/N/h89/4FvZpg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=fujitsu.com; dmarc=pass action=none header.from=fujitsu.com; dkim=pass header.d=fujitsu.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fujitsu.onmicrosoft.com; s=selector2-fujitsu-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/J4lAlcbWt4r+kUeIPrU34LL+wt0h/21xR9OYkOa5Ww=; b=EWGPCcRyQyHJNocQsBITER11c2fLDm6drqXQviAYV2CS3AKwmbGD3gt4LWyDEYLCMIbiStV0xM0UnpNBRxEezCPaFc2dGI7/E6ZLOzhxGK1gUZrWP5JUK8dYD1jng40uHEPlSWiYFMOLKGgXQYuzPPnaieVPD46T6KOQGQxCMSg= Received: from TYAPR01MB2990.jpnprd01.prod.outlook.com (2603:1096:404:86::19) by TY2PR01MB3707.jpnprd01.prod.outlook.com (2603:1096:404:dc::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3433.34; Wed, 30 Sep 2020 02:31:40 +0000 Received: from TYAPR01MB2990.jpnprd01.prod.outlook.com ([fe80::557a:777:f695:261d]) by TYAPR01MB2990.jpnprd01.prod.outlook.com ([fe80::557a:777:f695:261d%5]) with mapi id 15.20.3412.029; Wed, 30 Sep 2020 02:31:40 +0000 From: "tsunakawa.takay@fujitsu.com" To: 'Vladimir Sitnikov' CC: PostgreSQL Hackers Subject: RE: BLOB / CLOB support in PostgreSQL Thread-Topic: BLOB / CLOB support in PostgreSQL Thread-Index: AQHUJFZIRIa57Vu29k+56u3TB6b85qmC8uyAgAJlWJA= Date: Wed, 30 Sep 2020 02:31:40 +0000 Message-ID: References: In-Reply-To: Accept-Language: ja-JP, en-US Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=fujitsu.com; x-originating-ip: [218.44.52.181] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 08f9a26f-0c2f-4999-9cd7-08d864e8f6d0 x-ms-traffictypediagnostic: TY2PR01MB3707: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: h71enPDGwFJRxpgAfrEqe9HE2rDiMEKfQMzIb3mMvA37EvwsD29waakB+F2IHE3Vbl0PYAiJ+Lu9jBVRVbAKbn+IHsIpSc6eK7nh3eki0WsmJyannjv7JvW46W5xP5+Ifswz5LbdJ5ZsxLFFcDfkzbNvaQOdYXkcMgMLvfcuY7iqcFh1NxfjOJ3YLbousxZwwKKyhUYwxBTJwAP9MOtBmVyhDqNXiJ+VGo9BE3OkkiyfrnQHOM4dtdLmYRh+JLUGsh38v4cS67c7hSsAJf/r3hOu5LLMrGgyUTpUnnNsJgYo8PfBSolJcAAlUu+DZRwWuLU8KZzTSm8+bm564tKFpKzAJqKH7/QyPmnzqGxQAhShUPJfwf14IS2Eluyolbu/hT8kPVP1qvogWbKvuY0wOx3P/dDe+lyRXobHTcK1f64zJBgT3XPhQX3Zdyzh2GSiOj1a7g8jeUNb4Oo/I3GA7A== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYAPR01MB2990.jpnprd01.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(396003)(346002)(376002)(136003)(366004)(71200400001)(83080400001)(8676002)(6916009)(8936002)(26005)(66556008)(64756008)(66446008)(66476007)(66946007)(76116006)(6506007)(7696005)(5660300002)(186003)(85182001)(2906002)(52536014)(966005)(478600001)(316002)(4326008)(55016002)(9686003)(86362001)(33656002)(83380400001)(777600001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata: 43o7/3RA8ddTcOWFbU9cRXh5FNdF6O1JVgC2GHjF/hQbKhVSuNPzqbgCZgf/WPA2UX0b5/5YqikE4haBwO/IFB4YtYA/O5iaxygyJDFUzrEJfbp6nwbxYzfUKJBgK9xykPU0wbbY1w9+iFTEyUfx4JK2YBlWQQc/rHV4oVla0lAthqQE1OzQf7RVfPAMTYNGFJ7RwAv7+Tpolsl56BBDP9aeriJikvP0uOOVgKJ41tiit5857t8tlO+AXtrkgFOroiWA8IfADCgri92GNtQ/wCVf7Oh+SYloB8f1evr5n9S4jYz39VU+F7hikrFJ9VagmakpWP9s7jqFvhPZ8QPpiCE6qddssC3iBU73HrDgOp0hxqe8wKytkCreYawqGUEDhhbsDnq2oSlOPz5xPZJgY+4Nr+HXoAuuD5Vqcnw1/nEnzxIKXsc+4c3QmKuIe8+WahPbuJ2bvcpCR0nPptc0y2RjapNQQ+czfqwzWxma3WhIIRqqxRicwxNvmO+GbhjA0IdYSyJJJ3rEwqMGrpwP8QpUpevMyyaOnCIuJ/cCw1tuiz/33EgMIhU7ja4fuL5mDvDc1R2lLBP7Q/XVLl52+1mVKlK9BTrO0K28DZfkCmJSWmHS3MPmtGM7IT2tmCmKFjTUlhr4pdXi8q/ylCAIew== x-ms-exchange-transport-forked: True Content-Type: multipart/alternative; boundary="_000_TYAPR01MB29903553D7B67376E9DA4EB3FE330TYAPR01MB2990jpnp_" MIME-Version: 1.0 X-OriginatorOrg: fujitsu.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: TYAPR01MB2990.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 08f9a26f-0c2f-4999-9cd7-08d864e8f6d0 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Sep 2020 02:31:40.7643 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a19f121d-81e1-4858-a9d8-736e267fd4c7 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: T2sHY5QTE+yr7Kteg/Ua9LgBwNX2zX/hv/kXonadqaxu7KOzX4lVSInMp7uGMPNf0h6GWkdUrxGAeozzoRYosmSWpUtL9z4xTwayqQRyvEI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY2PR01MB3707 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --_000_TYAPR01MB29903553D7B67376E9DA4EB3FE330TYAPR01MB2990jpnp_ Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable From: Vladimir Sitnikov > Just in case, I'm PgJDBC committer. Thank you very much for your great efforts for the wonderful PgJDBC. I saw= you active. # I'd be happy if you send emails in text format so that the reply looks ni= ce. Your email seems to be in HTML. > and apparently, Andrew is surprised that the database lacks BLOB/CLOB sup= port. I was a bit surprised too when I first saw Postgres not support blob/clob b= ut bytea, because I had an impression that Postgres is highly SQL standard = compliant. I'm for adding blob/clob data types in server. At the same time, I wonder why Postgres had to add bytea instead of blob. = It may be that there are or were some technical issues. They may stand in = the way even now. One thing I can think of is the parameter format (text/binary). libpq's PQ= execParams() can specify input format for each parameter, but it can only s= pecify the output format for all returned columns, not for each column. As= a consequence, the bytea host variable support added in PG 12 can INSERT 1= GB of binary data, but retrieval of the value fails with an error message = like "invalid alloc request." That's because the server allocates twice th= e size of stored data to convert it into text format, whose size becomes ab= out 2 GB. That exceeds the limit palloc() can allocate. 33.3. Command Execution Functions https://www.postgresql.org/docs/devel/libpq-exec.html > The concerns to avoid "Clob maps to text" could be: > a) Once the behavior is implemented, it is hard to change. That is applic= ations would rely on it (and it becomes a defacto standard), and it would b= e hard to move to the proper "text with streaming API" datatype. > b) If we make , then people might start using update/substr= ing APIs (which is the primary motivation for Clob) without realizing there= =1B$B!G=1B(Bs full value update behind the scenes. Currently, they can use = setString/getString for text, and it is crystal clear that the text is upda= ted fully on every update. And if we treat clob as a synonym for text (just like the relationship betw= een char and nchar), even when the user writes clob in DDL, pg_dump will ou= tput it as text. That makes it a bit harder to use the output for other DB= MSs. Regards Takayuki Tsunakawa --_000_TYAPR01MB29903553D7B67376E9DA4EB3FE330TYAPR01MB2990jpnp_ Content-Type: text/html; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable

Fr= om: Vladimir Sitnikov <sitnikov.vladimir@gmail.com>

&g= t; Just in case, I'm PgJDBC committer.

 

Th= ank you very much for your great efforts for the wonderful PgJDBC.  I = saw you active.

 

# = I'd be happy if you send emails in text format so that the reply looks nice= .  Your email seems to be in HTML.

 

&g= t; and apparently, Andrew is surprised that the database lacks BLOB/CLOB su= pport.

 

I = was a bit surprised too when I first saw Postgres not support blob/clob but= bytea, because I had an impression that Postgres is highly SQL standard co= mpliant.  I'm for adding blob/clob data types in server.

 

At= the same time, I wonder why Postgres had to add bytea instead of blob.&nbs= p; It may be that there are or were some technical issues.  They may s= tand in the way even now.

 

On= e thing I can think of is the parameter format (text/binary).  libpq's= PQexecParams() can specify input format for each parameter, but it can onl= y specify the output format for all returned columns, not for each column.  As a consequence, the bytea host varia= ble support added in PG 12 can INSERT 1 GB of binary data, but retrieval of= the value fails with an error message like "invalid alloc request.&qu= ot;  That's because the server allocates twice the size of stored data to convert it into text format, whose size becomes= about 2 GB.  That exceeds the limit palloc() can allocate.=

 

33= .3. Command Execution Functions

ht= tps://www.postgresql.org/docs/devel/libpq-exec.html

 

 

&g= t; The concerns to avoid "Clob maps to text" could be:=

&g= t; a) Once the behavior is implemented, it is hard to change. That is appli= cations 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.

&g= t; b) If we make «clob is text», then people might start using = update/substring APIs (which is the primary motivation for Clob) without re= alizing there=1B$B!G=1B(Bs full value update behind the scenes. Currently, they can use setString/getString for text, and it is crystal cl= ear that the text is updated fully on every update.

 

An= d if we treat clob as a synonym for text (just like the relationship betwee= n char and nchar), even when the user writes clob in DDL, pg_dump will outp= ut it as text.  That makes it a bit harder to use the output for other DBMSs.

 

 

Re= gards

Takayuki Tsunakawa

 

--_000_TYAPR01MB29903553D7B67376E9DA4EB3FE330TYAPR01MB2990jpnp_--