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 1s8bSm-00DzYk-9A for pgsql-hackers@arkaria.postgresql.org; Sun, 19 May 2024 08:00:13 +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 1s8bSk-00BzOk-Gy for pgsql-hackers@arkaria.postgresql.org; Sun, 19 May 2024 08:00:10 +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 1s8bSk-00BzOc-5L for pgsql-hackers@lists.postgresql.org; Sun, 19 May 2024 08:00:10 +0000 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1s8bSc-00102s-T0 for pgsql-hackers@lists.postgresql.org; Sun, 19 May 2024 08:00:09 +0000 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-51f72a29f13so2535388e87.3 for ; Sun, 19 May 2024 01:00:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716105602; x=1716710402; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=iMsHFx8fyuFNZQrxIA46rpFr5VuTUSXuVxgKLVX/6bA=; b=izQn6Z1XOEDxzMMCsTVZ52Hk7efSJ+NnIN3c49o5i1FVPyJyPlkxgGiLgXk+VO22hx t/0gRYHjtPB61Za51OvdRpPSc24zQAhOcT5ZHRDc3VuKzNOztrVKc5yG4vUH+l3WthWt 3D5BFaHaJkIJtf617SsLU7feOJR3rnzHBh6WIvT/LE5DpPWlU0g5fL02XLdnE3TDiSXX PV3o2EdmmE+4JcpPGnPpQmzpaJ65t63k3Ym5lZoynSOve4P0DpC0qzyPYec71qfltQLx qFy48hz/sLt+LrXYOIKKJXrfFFb2fWcHbeW5eiBuqW3uhPNoHPRG+NnLvxUCNLc1LmlC sMwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716105602; x=1716710402; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=iMsHFx8fyuFNZQrxIA46rpFr5VuTUSXuVxgKLVX/6bA=; b=iLR5yDOTV9P0py3z8jEp4ZrRyqermJyzuaEntEILGmTjdymQAeAAiXqysb8ylMftK4 Cj0JrImxS0/7jLSOOjbxFZRsTTAowMsuyqOYE23rT1mgzBQ7RfQRUjx1XYTs5UxCPmcT Q208AcObUr0Yd4C41YG69ws38flBT4oRV3wH3gSKI4e70Tav7IEraVXkGP8Va4qaXG5j GrH2aXIuubngB6z2w+dMC9BNLj6p+s6EjQjZU7WQVw+60s7XP6aK6yNSi+YG5APxIeQb ZtRlhydG1WdKUEl5cRxqAvORi6rEHtw8QgVd/qfXnD7Z00WkrThKJR4apLpjokBcyVoI 334w== X-Gm-Message-State: AOJu0YzaNrOQRGckZuU7I4pGYIQGfVqzruv1W8GeScUSjOu2kCFq1VeT Ya7lKBkfxseuhxaINpOxQwkd0xLEYqbqsorQnX+NhZ90ojgvSglf X-Google-Smtp-Source: AGHT+IGFXybo+Vxxjmp/ad+sl90vc7FnHv9ctj3rN6ZquSEh0XFCcQsjF4Jd3Nv61vzZvewmyZxfBw== X-Received: by 2002:a19:5f41:0:b0:518:9362:f63 with SMTP id 2adb3069b0e04-5220f97041fmr16329707e87.0.1716105601916; Sun, 19 May 2024 01:00:01 -0700 (PDT) Received: from [1.0.0.7] ([178.155.16.152]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-521f35ad3fcsm3806582e87.51.2024.05.19.01.00.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 19 May 2024 01:00:01 -0700 (PDT) Message-ID: <91643cfa-16f4-1bc2-e235-0dfa6d285b3a@gmail.com> Date: Sun, 19 May 2024 11:00:00 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: Avoid orphaned objects dependencies, take 3 Content-Language: en-US To: Bertrand Drouvot , Michael Paquier Cc: pgsql-hackers@lists.postgresql.org References: <62310067-6dc4-97ab-6724-7d3602b5056d@gmail.com> <403075e1-4d60-09e2-a06a-749cd9d88f66@gmail.com> From: Alexander Lakhin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello Bertrand, 15.05.2024 11:31, Bertrand Drouvot wrote: > On Wed, May 15, 2024 at 10:14:09AM +0900, Michael Paquier wrote: > >> + if (object_description) >> + ereport(ERROR, errmsg("%s does not exist", object_description)); >> + else >> + ereport(ERROR, errmsg("a dependent object does not ex >> >> This generates an internal error code. Is that intended? > Yes, it's like when say you want to create an object in a schema that does not > exist (see get_namespace_oid()). AFAICS, get_namespace_oid() throws not ERRCODE_INTERNAL_ERROR, but ERRCODE_UNDEFINED_SCHEMA: # SELECT regtype('unknown_schema.type'); ERROR:  schema "unknown_schema" does not exist LINE 1: SELECT regtype('unknown_schema.type');                        ^ # \echo :LAST_ERROR_SQLSTATE 3F000 Probably, it's worth to avoid ERRCODE_INTERNAL_ERROR here in light of [1] and [2], as these errors are not that abnormal (not Assert-like). [1] https://www.postgresql.org/message-id/Zic_GNgos5sMxKoa%40paquier.xyz [2] https://commitfest.postgresql.org/48/4735/ Best regards, Alexander