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 1kFjzs-0005Sf-G4 for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Sep 2020 20:13:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kFjzr-0004lR-8P for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Sep 2020 20:13:43 +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 1kFjzq-0004lG-Vb for pgsql-hackers@lists.postgresql.org; Tue, 08 Sep 2020 20:13:43 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kFjzn-0002ev-Ps for pgsql-hackers@postgresql.org; Tue, 08 Sep 2020 20:13:41 +0000 Received: by mail-wr1-x441.google.com with SMTP id w5so505299wrp.8 for ; Tue, 08 Sep 2020 13:13:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=fTQODJOnyw3T9IEVdT3cZHxqc3Gka4xU9Xl+zmIzT8s=; b=tykVk2GlNpsQMWbLVo2KS1BO5KaP3uMwgaPvrQRfOF47rSlXdfu1jQBZDuZUPojpzB 6Yg7W0e+hNhzT1xR2S6dcUJRynMroEb/grR3Ud6qBEc3NqVqs5CMHIUAHtEKfQjr565b 9fx31IvBI0jJcOQiCA0mql2KaoNpLU75hbL5dupAbSGl3E8AO2KWqAmHZfibAx//D1E7 OUeA13gu01d3j3Dn9377W68QayUCstZCJ5zHgzhJgBWxzvfjE7aHAiIDyr9zoucU2JBo MgQMI1sjOKdU8OjwXpSV4Maqqk6oFLBXWwy9HUGgjhooLXeeJS9jEsH6flKirn/PcNvh cZYw== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=fTQODJOnyw3T9IEVdT3cZHxqc3Gka4xU9Xl+zmIzT8s=; b=YPM1giUvogMO2cdHzkVRKmJWDlk24PLsBqm6ATgDGnh75U2h7dKSM0dqEBgMLJZGta 2iflooQW9raTYYPA80am/l7323YqlSKlj+s/wGDgz2eTLUqd3WPpVif3CKV9dtH/svr3 vARQjX1Gr0Xx+PFa0Ds6cod1v5HJ228mcPSjr4CyobZkqhsv8TvtB8YVNkj3pGMElWuD ejtNhzeLZj9ajv9PfVAZG29GKOIGPIE0nAuDAeAdh+VcXdrq3KnMvyLMrAWcY/7+4P9f ToUu0CA7l/n9dvTSiVLwxnGfLrG8KiJuW08yyrESJI7eMHxjvVNhtX1YSQ+pXOrp0Zji 5NDw== X-Gm-Message-State: AOAM530k23vjaE+SDK4HyKdua7X/64MjAv7y2SRQznjd3qcruTa/uzj3 tGxsemFR89IsZg58qKcECUo= X-Google-Smtp-Source: ABdhPJyBTz0Ea5xgdY165ALU42b84fMo+3J8DpSeU3CfsaoDrkI2agbGO4vUhNo5BjJDSp81AngKvg== X-Received: by 2002:adf:ff83:: with SMTP id j3mr193340wrr.135.1599596018262; Tue, 08 Sep 2020 13:13:38 -0700 (PDT) Received: from nol (82-64-124-11.subs.proxad.net. [82.64.124.11]) by smtp.gmail.com with ESMTPSA id k8sm688777wrl.42.2020.09.08.13.13.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 13:13:37 -0700 (PDT) Date: Tue, 8 Sep 2020 22:13:34 +0200 From: Julien Rouhaud To: Christoph Berg , Michael Paquier , Thomas Munro , Peter Eisentraut , Robert Haas , Laurenz Albe , Douglas Doole , Pg Hackers Subject: Re: Collation versioning Message-ID: <20200908201334.GB57691@nol> References: <13b0c950-80f9-4c10-7e0f-f59feac56a98@2ndquadrant.com> <20200813095204.f7mlgdzsbaxa3mzr@nol> <20200814073746.GF2057@paquier.xyz> <20200814090235.ifld2qvaw43pzpzg@nol> <20200907031741.GK2455@paquier.xyz> <20200908144507.GA57691@nol> <20200908193326.GA108231@msg.df7cb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200908193326.GA108231@msg.df7cb.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, Sep 08, 2020 at 09:33:26PM +0200, Christoph Berg wrote: > Re: Julien Rouhaud > > Here's the rationale for this new flag, extracted from the patch's commit > > message: > > > > Add a new amnostablecollorder flag in IndexAmRoutine. > > > > This flag indicates if the access method does not rely on a stable collation > > ordering for deterministic collation, i.e. would not be corrupted if the > > underlying collation library changes its ordering. This is done this way to > > make sure that if any external access method isn't updated to correctly setup > > this flag it will be assumed to rely on a stable collation ordering as this > > should be the case for the majority of access methods. > > > > This flag will be useful for an upcoming commit that will add detection of > > possibly corrupted index due to changed collation library version. > > Hmm. Does that flag gain us much? What about non-collation locale > changes that might still affect indexes like lower() and the citext > extension? That still depends on locale changes, but that flag > wouldn't be able to help with "this index is (not) affected by this > locale change". > > IOW, I think we should aim at simply tracking the version, and leave > it to the admin (with the help of supplied SQL queries) to either > rebuild indexes or waive them. > > Or maybe I misunderstood the problem. > I see your point, and indeed this isn't really clear how the flag will be used given this description. I guess that my idea is that how exactly an index depends on a stable collation ordering isn't part of this flag definition, as it should be the same for any access method. In the commit that uses the infrastructure, the lack of stable ordering requirement is only used for index key column, but not for any expression, whether on index key or qual, because as you mention there's no guarantee that the expression itself depends on a stable ordering or not. There could be some improvements done for some simple case (like maybe md5() is used often enough in index keys that it could be worth to detect), but nothing in done to attempt that for now.