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.89) (envelope-from ) id 1h1jtg-0007Bh-Gm for pgsql-admin@arkaria.postgresql.org; Thu, 07 Mar 2019 03:40:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h1jte-0007BU-GN for pgsql-admin@arkaria.postgresql.org; Thu, 07 Mar 2019 03:40:38 +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 1h1jte-0007Ao-4j for pgsql-admin@lists.postgresql.org; Thu, 07 Mar 2019 03:40:38 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h1jta-0005Pk-SF for pgsql-admin@lists.postgresql.org; Thu, 07 Mar 2019 03:40:36 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x273eVPC021020; Wed, 6 Mar 2019 22:40:31 -0500 From: Tom Lane To: Paul Draper cc: pgsql-admin@lists.postgresql.org Subject: Re: Support for U+0000 text In-reply-to: References: Comments: In-reply-to Paul Draper message dated "Wed, 06 Mar 2019 20:06:10 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <21018.1551930031.1@sss.pgh.pa.us> Date: Wed, 06 Mar 2019 22:40:31 -0500 Message-ID: <21019.1551930031@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Paul Draper writes: > When inserting the U+0000 (NULL) character, PostgreSQL errors: > ERROR: invalid byte sequence for encoding "UTF8": 0x00 > I understand I could not use the text type, but given that this is a valid > Unicode character, is there a reason this is not supported? Yes: internally, the text representation of all data types is a C string, ie a \0-terminated string. That's not something that's practical to change. regards, tom lane