Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ryIe8-00FVCM-JX for pgsql-hackers@arkaria.postgresql.org; Sat, 20 Apr 2024 21:53:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ryIe5-00C6FV-EO for pgsql-hackers@arkaria.postgresql.org; Sat, 20 Apr 2024 21:53:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ryIe5-00C6FM-4A for pgsql-hackers@lists.postgresql.org; Sat, 20 Apr 2024 21:53:17 +0000 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1ryIdz-0022JA-SP for pgsql-hackers@lists.postgresql.org; Sat, 20 Apr 2024 21:53:15 +0000 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-a555b203587so361583166b.3 for ; Sat, 20 Apr 2024 14:53:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1713649989; x=1714254789; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=FGJmwMubXJ+ey4jdB1sLZrtAH5pZ5LOLJ+ME5qWEW80=; b=Djrmz4P78OVl7jYofAYVHvk5L+EUGs2b4Cun8ROVQbFim2wT9J2IOP37JMtNsQi/tE HWjyEy6ecuVE/Z1Aw9SvNdRRKA7KIv13I8Y5AkkAZQM3He87K6HPPY+d/9gV9jNTOoZO xYp6cVyB1lSJuWUN4/sAmyuqPWM42p3wsFUVogOKEcIFDZWrsc2v+fgeRhI1G68mr63w yixxAzzC7JxkOjkZq+was4z3Fbc6ywQDWjCWn4SUBZ/y9xNAlh6LA8PlPxX5evKG2ydA g5YYK/MbNajFW13k4NBrp01HVpo9sw/KMCaApgDvwhfUZAdeTjT/0NAsHXNBdIaJBJcO JfTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713649989; x=1714254789; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FGJmwMubXJ+ey4jdB1sLZrtAH5pZ5LOLJ+ME5qWEW80=; b=mIrn10Q3pZFh06oq6dLC9v4olEyUyZDiePooR2oNu+09+i/RpG9UssWOIyIh/B3+YR q0UEl+XWXiH4Xu2oFxqJz/Zhntjg0Te+jJlPmh5ZzfyVmj2D0wesNrPgfk2pf+oEJNnG RaqPSbekZUY1e5oVQgk6p6GVC0mFwJsKuZxOVJXw+XF/AgZpEp1Ki6dQqU/AckbmQcTr GgWyxkkkOhBZOd6/k3wJUW3a0OUO5Wb93GEi0MOJvOhJvjLylvoEy8u2WZoGSgwye2Gn EPW/EtzbFXHJCJEo2yoG6Fi20tOzUH1NFDMGbEfQybVNQc6q+QDWINWvqoz/TxO1Z0x/ 6HZw== X-Gm-Message-State: AOJu0YwaKH4y1kfdT87KY2+ZL7NlZmbwPBbr+OcCaT7xdfB477PJvoMo MHKwJCJH8VSXZZDoZ0XZWi/b0ju2Aqf+W7nmgsTh/Pq0HX6cknAx0Fvf0GeE+QZ0i4omosOMC7g = X-Google-Smtp-Source: AGHT+IFq53zWB3CZ92EQCPIjaPEBoNxhkGrtCKEJalWGeuq+e1uvKjbwd5SoqKy1Mgb+ReB19sL7gw== X-Received: by 2002:a17:906:f907:b0:a53:f12b:2ecf with SMTP id lc7-20020a170906f90700b00a53f12b2ecfmr3992495ejb.2.1713649988327; Sat, 20 Apr 2024 14:53:08 -0700 (PDT) Received: from [10.137.0.18] (ip-86-49-229-30.bb.vodafone.cz. [86.49.229.30]) by smtp.gmail.com with ESMTPSA id e20-20020a170906315400b00a5591a644c8sm1685420eje.17.2024.04.20.14.53.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 20 Apr 2024 14:53:07 -0700 (PDT) Message-ID: <86ed7de6-2f04-4c38-ae82-7927da98e38e@enterprisedb.com> Date: Sat, 20 Apr 2024 23:53:06 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: createdb compares strategy as case-sensitive To: Tom Lane Cc: PostgreSQL Hackers References: <90c6913a-1dd2-42b4-8365-ce3b09c39b17@enterprisedb.com> <2568919.1713645640@sss.pgh.pa.us> Content-Language: en-US From: Tomas Vondra In-Reply-To: <2568919.1713645640@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 4/20/24 22:40, Tom Lane wrote: > Tomas Vondra writes: >> While doing some testing with createdb, I noticed it only accepts >> file_copy/wal_log as valid strategies, not FILE_COPY/WAL_LOG (which is >> what the docs say). The same thing applies to CREATE DATABASE. > > Hmm, actually it does work in CREATE DATABASE: > > regression=# create database foo STRATEGY = FILE_COPY; > CREATE DATABASE > > but it fails in createdb because that does > > if (strategy) > appendPQExpBuffer(&sql, " STRATEGY %s", fmtId(strategy)); > > and fmtId will double-quote the strategy if it's upper-case, and then > the backend grammar doesn't case-fold it, and kaboom. > Oh, right. I should have tested CREATE DATABASE instead of just assuming it has the same issue ... >> The problem is that createdb() does the check using strcmp() which is >> case-sensitive. IMHO this should do pg_strcasecmp() which is what we do >> for other string parameters nearby. > > Seems reasonable. The alternative could be to remove createdb.c's use > of fmtId() here, but I don't think that's actually better. > Why? It seems to me this is quite close to e.g. LOCALE_PROVIDER, and we don't do fmtId() for that. So why should we do that for STRATEGY? regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company