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 1tl3oh-008yOj-Uw for pgsql-hackers@arkaria.postgresql.org; Thu, 20 Feb 2025 10:30:03 +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 1tl3og-004YRu-Fg for pgsql-hackers@arkaria.postgresql.org; Thu, 20 Feb 2025 10:30:02 +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 1tl3og-004YRm-6H for pgsql-hackers@lists.postgresql.org; Thu, 20 Feb 2025 10:30:02 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tl3od-001wTk-39 for pgsql-hackers@lists.postgresql.org; Thu, 20 Feb 2025 10:30:02 +0000 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4399deda4bfso4833085e9.0 for ; Thu, 20 Feb 2025 02:29:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740047399; x=1740652199; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=M7xLEeO84zu04UOiU9bEfn/F+riJOpPEXywlj+SJa/A=; b=R/T1063y7oVXYEhUs5f1pZxrkT9OAQNLYmh6R8ud5305+XLDllhs8Bzjv8h0vJ+sVb A8pdhhjBFPGmuuWIpiB+sgKvIgchTaKUR3PHTP8xql/8ALcBOVZEcrJtLyJjakLjMcIp srzyJ3mcGXQz4fNJDDGG8AVUCKWPztU1jc+PzsxIlUFPX4WL/YD5jWIDrStU83hqnmBx 4/1Z9DZiYIM8blaMnyItixSZOL0zzqoIVJG40Aurs2yqYvQjU73S5bJsYpubW60tz02I wSv3tfDQAxk6IgW93Qw1Lz5eWt+DZ6CSfyOCz1bbDDHbRXO7sy00Qi3HuZs0QUa8ek/d 9EJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740047399; x=1740652199; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=M7xLEeO84zu04UOiU9bEfn/F+riJOpPEXywlj+SJa/A=; b=VcgjqFq0sbsqRx4eL61AyYxlz/oruO/eDTIEoqw/NwrrsPJFhJB6kehwtFLXFZMp7f KJ7q1PaMQiISNWAwfqr2CKb3N9Kz1Xpx6Q7DTLtAqQTFfQyD4qWXpk2cSSoZykuplfJJ 1pmDvo3gBU7Tiy2lQcBNslusfZMP8Jc5s67B3CIP5Iib7mV1c3cBN5Sin/yXcLkmQYV5 BU5desJZCufFVN2RIlBNiN7/dE7y+noEz+4gFfb+krLklcOgttDBQxAFke3MRQLAXpXc 2wTnUL0f795h5YZxGktaRg7qzYCJbXfYz3LtmJBKrG0MrNAzmNH1X3La85cF+kWMlLaI q79g== X-Forwarded-Encrypted: i=1; AJvYcCVHXU6zyHjqQyWvTmQDFKYDwthxKWLoJouq8aLdOY/yHYLlzHcDrn5bUsOhTWzMfStpqe11sTAReEyOQsA+@lists.postgresql.org X-Gm-Message-State: AOJu0YwT5btrSzWykS1q1PfvbjGJpODidIE15dmKwIhmudJdqUpdZhSJ CPLibdETDORqr+N7jp9K2CLNnGJ0zliXvcGu4WxQLj+qzu9YK7ks X-Gm-Gg: ASbGncsovZEqYH17II31KK5QpwWYPURQHq1Dp/+ZrQ/Si2l79OgBx2IxrFkoE7trmXH AwPBhicPrwpwH0HlC2FojDQbM9mLa+KuH+MDNEcH+4WxODgelXCdnQKfT5Jc8CJT7CQdURZgZqL H//CUxFSTgHuMkiVwPPWg+6cIq0/GQyoJuvsGietq3YfgRHi+vZQUrYIuN26U6uAehVkibfTniX cb58MOYl3q14knGle7nZqknWIHipkG9RBL7ew3wArVZq86XUnytwDKzhrczcNxaEg0863NQlbOC 0vWEvrqpHYJ+X1Pav2dDrfMR5JfrS01Xxy1wMS7lO3Nhn0p09m92Vf2vJmxXRgb5BSknYezZ3Ql NKytJCBtOgJ1OGsU1JYPQG+82HRkzRdjbNsz1kajWFpeB63I= X-Google-Smtp-Source: AGHT+IGrralRgTYZu/SVdT6WpEWQvCk7OfhmbLI3bQsvLS1/5wMYZRP/bFSdraTOWkSmyBMExLJrtg== X-Received: by 2002:a05:600c:1e89:b0:439:9828:c447 with SMTP id 5b1f17b1804b1-439a7b81c85mr10608405e9.17.1740047398258; Thu, 20 Feb 2025 02:29:58 -0800 (PST) Received: from ip-10-97-1-34.eu-west-3.compute.internal (ec2-15-237-181-182.eu-west-3.compute.amazonaws.com. [15.237.181.182]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4398cb4de78sm94108915e9.24.2025.02.20.02.29.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Feb 2025 02:29:57 -0800 (PST) Date: Thu, 20 Feb 2025 10:29:56 +0000 From: Bertrand Drouvot To: "Hayato Kuroda (Fujitsu)" Cc: 'Michael Paquier' , "'pgsql-hackers@lists.postgresql.org'" Subject: Re: ReplicationSlotRelease() crashes when the instance is in the single user mode Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Thu, Feb 20, 2025 at 02:22:41AM +0000, Hayato Kuroda (Fujitsu) wrote: > Dear Michael, > Thanks for the report and the patch! > > I did not check how these call behave individually, just a few > > comments while putting my eyes on the patch. > > > > + if (!IsUnderPostmaster) > > + elog(ERROR, > > + "slot operation is prohibited in the single user mode"); > > > > elog() should not be used for failures that can be user-facing as this > > would not provide any translation. > > I intentionally used elog() because I thought single user mode is not user-facing. > But it is OK for me to use ereport() instead. Yeah, I think it's also about using ereport for cases that we think can happen ( and so needs to be translated). In this case, it clearly can happen so ereport() is better. > > I'd suggest rewording the error message to provide some more context, > > as well, say: > > "cannot use %s in single-user mode", "function_name" > > Fixed. PSA new version === 1 Nit: "cannot use function %s in single-user mode", "function_name"" maybe? (that would somehow match the existing ""user-defined types cannot use subscripting function %s") === 2 + "pg_copy_replication_slot"))); s/pg_copy_replication_slot/copy_replication_slot/ maybe? As it is the function that would report the error actually (could be called from pg_copy_logical_replication_slot_[a|b|c] and pg_copy_physical_replication_slot_[a|b] though). Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com