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 1hPjdN-0000uT-1B for pgsql-hackers@arkaria.postgresql.org; Sun, 12 May 2019 08:15:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hPjcM-0001Ss-6J for pgsql-hackers@arkaria.postgresql.org; Sun, 12 May 2019 08:13:58 +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 1hPjcK-0001Sl-Ue for pgsql-hackers@lists.postgresql.org; Sun, 12 May 2019 08:13:57 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hPjcG-0000In-Ge for pgsql-hackers@postgresql.org; Sun, 12 May 2019 08:13:54 +0000 Received: by mail-pl1-x641.google.com with SMTP id d21so4878346plr.3 for ; Sun, 12 May 2019 01:13:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=osP0h/u1JS7AhnDuc86KtKnBZGsfLYVOb7xK5Uh2DDw=; b=NyRg7Nj/HDxQsmimMfeRYOkIlIm1NrKEVoUShn3jUTSfhBR8bfY2omrprZ9bl1J0uE 2SXGo+RWcf5MwEbui6TvwgROokXjBI5cjVybHddVLfQOrPk9Cx7Ztt08kmEkKKjsVTsa 937b4h9uHwJEbDob0W4UsIZXhI+jh+pN7x1Ls= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=osP0h/u1JS7AhnDuc86KtKnBZGsfLYVOb7xK5Uh2DDw=; b=cbHYhn9sKZcXuJUdgJDAxHnGrUroJnsIUqn917iM7kAevkFjcU8HC+G9Lm8JOUNAqv PRjaSOaPFi8oegpEzrZLlH7uGu9HX0Uo8WKlTFAoKLePHXOKnKlg27WoMvmF4S91wR2z UqPbS+Xl3NkbuvvlxT0NqAKV4MJmHhjvmG+fohsSrvV55N/fEjhjkDMjcjo8z6YEUG73 wV1otEiCYZo53vDQrHHWCntG2Ul2+ezdK6rW2bt9UYv8t9ovDUX4uUywI5JejaPjaXgy nrQJgv6j/7Si/dI7xtBj+5UjldARw8plUo9a84RFSUX3gUDz7wcZKeJ6oTcfqS3z2Iip XIyw== X-Gm-Message-State: APjAAAXkCMP3v93fCUrW6lWtmPL8yztWTG0Xn1KRgSR7tBIOrE+hFlx2 qZAvhLzzzyS29HcYCB0B4HFrPw== X-Google-Smtp-Source: APXvYqx7/VDmIJVHUq4dJzdICCcdYBEN8vqQ0bK/lhDnExl1mMdb+mUHvFI15mcXIFQw+eTc4P9bOA== X-Received: by 2002:a17:902:b492:: with SMTP id y18mr19252306plr.96.1557648831262; Sun, 12 May 2019 01:13:51 -0700 (PDT) Received: from rfd.leadboat.com (108-233-125-46.lightspeed.sntcca.sbcglobal.net. [108.233.125.46]) by smtp.gmail.com with ESMTPSA id h25sm18557206pfd.142.2019.05.12.01.13.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 May 2019 01:13:49 -0700 (PDT) Date: Sun, 12 May 2019 01:13:47 -0700 From: Noah Misch To: Tom Lane Cc: Andrew Dunstan , PostgreSQL Hackers Subject: Re: Augment every test postgresql.conf Message-ID: <20190512081347.GA1173385@rfd.leadboat.com> References: <20181229021950.GA3302966@rfd.leadboat.com> <20181230024014.GA181668@gust.leadboat.com> <16623.1546141591@sss.pgh.pa.us> <20181230055346.GB156585@gust.leadboat.com> <20190407064156.GC1914190@rfd.leadboat.com> <20190512015615.GD1124997@rfd.leadboat.com> <25383.1557629039@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <25383.1557629039@sss.pgh.pa.us> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sat, May 11, 2019 at 10:43:59PM -0400, Tom Lane wrote: > Noah Misch writes: > > Pushed. This broke 010_dump_connstr.pl on bowerbird, introducing 'invalid > > byte sequence for encoding "UTF8"' errors. That's because log_connections > > renders this 010_dump_connstr.pl solution insufficient: > > Ugh. > > > 4. If GetMessageEncoding()==PG_SQL_ASCII, make pgwin32_message_to_UTF16() > > return NULL. The caller will always send untranslated bytes to write() or > > ReportEventA(). This seems consistent with the SQL_ASCII concept and with > > pg_do_encoding_conversion()'s interpretation of SQL_ASCII. > > > 5. When including a datname or rolname value in a message, hex-escape > > non-ASCII bytes. They are byte sequences, not text of known encoding. > > This preserves the most information, but it's overkill and ugly in the > > probably-common case of one encoding across all databases of a cluster. > > > I'm inclined to do (1) in back branches and (4) in HEAD only. (If starting > > fresh today, I would store the encoding of each rolname and dbname or just use > > UTF8 for those particular fields.) Other preferences? > > I agree that (4) is a fairly reasonable thing to do, and wouldn't mind > back-patching that. Okay. Absent objections, I'll just do it that way. > Taking a wider view, this seems closely related > to something I've been thinking about in connection with the recent > pg_stat_activity contretemps: that mechanism is also shoving strings > across database boundaries without a lot of worry about encodings. > Maybe we should try to develop a common solution. > > One difference from the datname/rolname situation is that for > pg_stat_activity we can know the source encoding --- we aren't storing > it now, but we easily could. If we're thinking of a future solution > only, adding a "name encoding" field to relevant shared catalogs makes > sense perhaps. Alternatively, requiring names in shared catalogs to be > UTF8 might be a reasonable answer too. > > In all these cases, throwing an error when we can't translate a character > into the destination encoding is not very pleasant. For pg_stat_activity, > I was imagining that translating such characters to '?' might be the best > answer. I don't know if we can get away with that for the datname/rolname > case --- at the very least, it opens problems with apparent duplication of > names that should be unique. I don't much like your hex-encoding answer, > though; that has its own uniqueness-violation hazards, plus it's ugly. Another case of byte sequence masquerading as text is pg_settings.setting. In most contexts, it's important to convey exact values. Error messages can use '?'. I wouldn't let dump/reload of a rolname corrupt it that way, and I wouldn't recognize the '?' version for authentication. While pg_stat_activity.query could use '?', I'd encourage adding bytea and encoding columns for exact transmission. pg_stat_activity can't standardize on UTF8 without shrinking the set of valid queries or inaccurately reporting some, neither of which is attractive. datname/rolname could afford to be more prescriptive, since non-ASCII names are full of bugs today. A useful consequence of UTF8 datname/rolname would be today's "pg_dumpall --globals" remaining simple. If we were to support arbitrary encodings with a "name encoding" field, the general-case equivalent of "pg_dumpall --globals" would connect to several databases of different encodings in order to dump all objects, perhaps even creating a temporary database if no suitable-encoding database existed. MULE_INTERNAL presents trouble since we don't have a UTF8<->MULE_INTERNAL conversion. If we standardized cross-database strings on UTF8, it would be impossible to read such strings, create roles, etc. from a MULE_INTERNAL database. I suppose we'd either add the conversion or deprecate MULE_INTERNAL, forbidding its use as the initdb encoding.