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 1iuepr-0002mR-IG for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Jan 2020 15:55:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iuepq-0001YF-Ax for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Jan 2020 15:55: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 1iuepp-0001Y1-Vf for pgsql-hackers@lists.postgresql.org; Thu, 23 Jan 2020 15:55:58 +0000 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iuepn-00044G-HR for pgsql-hackers@lists.postgresql.org; Thu, 23 Jan 2020 15:55:56 +0000 Received: by mail-qt1-x844.google.com with SMTP id e5so2829752qtm.6 for ; Thu, 23 Jan 2020 07:55:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=bKjPFqOeMMkzarv7CfuYd8QQpxFmEit3ngz1ppM0Rws=; b=TjlfR54dxNNaCIu5hFxxyUbxLV3CnDWxshS0qWm3My2XdgvDsM7KdS9Lsp14IyKgDl Dsh3NMDAKjCMr1bJ6yiRncAstlMV6MYCakWg6pzJvqk1BlKm5i71uGczHHbh8ZXZw8OG NllnkXoaELRgRagfFJgH27GoWtI1a1IN9cTqE/C9jk5F/hw+uJniJ7DVOCmDME7O2DFo TkKCn1Zxry511LCz6zE51Jk278gl6LnYjNJV2OcH1bIObod+jsLZOC9o+15D+s3SzVYH 6u6MbejnGDyuWawQuD/6M1PWLtJd3j5h1ajBK4ZUM/w1zzmq0lDXpy5FPPzOM/6ilj7p oMhw== 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:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=bKjPFqOeMMkzarv7CfuYd8QQpxFmEit3ngz1ppM0Rws=; b=qv+SR/7/hLAWkLm91yU5P1G9blJzkrvzp/UpWbwG04TNfkASh4DQHhwqeyqu4hkT4E P96sdor+fv7HdYthwT4jED1NtyFGX2unaKWNuv0p6WZ/k7jsfZU3ytg/MVnKmBwqvW2F 1cNuznq7pEFIql1WUUAZPsRRi1/IL65Uv+Fg3OmA7Ru1kjbjOLqQNBnST81URrl3xMVy y2/8KRzGZ+SUa4wvyvjdW3+QfK1UM0vGUTEwJeaQ7QmQuWruty7ibgOAQ6vyJ8ujhk/+ hdtfwt4YOrPS0HjoUbcYzxFUepIk2g2YZQkumQggIcC3IrKGUDfSoZdCvWH8Y6wt4KtU TIzA== X-Gm-Message-State: APjAAAUmR9j1zA8h9g53aVhY5JEX/ZJVoqoraI2joO+POs5iy4tdK9KO QNOpgn86FbH4i1suqQH2MuylIQ== X-Google-Smtp-Source: APXvYqw+UVYHcZv9mW4Qas/ErCZOZ4+cephJUZOq1caMQqjeXzNDhenaJZyqa6Y7CeLiHYJJEHRGUA== X-Received: by 2002:aed:2047:: with SMTP id 65mr16965863qta.78.1579794954527; Thu, 23 Jan 2020 07:55:54 -0800 (PST) Received: from nimloth.alvh.no-ip.org ([179.56.96.77]) by smtp.gmail.com with ESMTPSA id k7sm1073154qtd.79.2020.01.23.07.55.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jan 2020 07:55:53 -0800 (PST) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 24C1B300A9E; Thu, 23 Jan 2020 12:55:52 -0300 (-03) Date: Thu, 23 Jan 2020 12:55:52 -0300 From: Alvaro Herrera To: Tom Lane Cc: Arthur Zakirov , Juan =?iso-8859-1?Q?Jos=E9_Santamar=EDa?= Flecha , Tomas Vondra , PostgreSQL Hackers Subject: Re: Allow to_date() and to_timestamp() to accept localized names Message-ID: <20200123155552.GA20980@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <12102.1579754521@sss.pgh.pa.us> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Jan-22, Tom Lane wrote: > Arthur Zakirov writes: > > On 2020/01/23 7:11, Tom Lane wrote: > >> Closer examination shows that the "max" argument is pretty bogus as > >> well. It doesn't do anything except confuse the reader, because there > >> are no cases where the value passed is less than the maximum array entry > >> length, so it never acts to change seq_search's behavior. So we should > >> just drop that behavior from seq_search, too, and redefine "max" as > >> having no purpose except to specify how much of the string to show in > >> error messages. There's still a question of what that should be for > >> non-English cases, but at least we now have a clear idea of what we > >> need the value to do. > > > Shouldn't we just show all remaining string instead of truncating it? > > That would avoid a bunch of arbitrary decisions, for sure. > Anybody have an objection? I think it would be clearer to search for whitespace starting at the start of the bogus token and stop there. It might not be perfect, particularly if any language has whitespace in a month etc name (I don't know any example but I guess it's not impossible for it to exist; Portuguese weekday names maybe?), but it seems better than either of the behaviors shown above. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services