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 1s2NcF-002X9m-Js for pgsql-bugs@arkaria.postgresql.org; Thu, 02 May 2024 04:00:15 +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 1s2NcC-00FYXA-ID for pgsql-bugs@arkaria.postgresql.org; Thu, 02 May 2024 04:00:13 +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 1s2NcC-00FYX2-96 for pgsql-bugs@lists.postgresql.org; Thu, 02 May 2024 04:00:13 +0000 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1s2Nc6-0016qA-Fg for pgsql-bugs@lists.postgresql.org; Thu, 02 May 2024 04:00:12 +0000 Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-51f174e316eso313041e87.0 for ; Wed, 01 May 2024 21:00:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714622405; x=1715227205; 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=9G0PnPmWfaPJfpqHRvE0rSTyh8mID58ozqAZB3od5Rc=; b=E2kyZDXZEji40Q6XQeD9/Rz7NIl0eiFKrgd6s0cTV6OvGVjcu2/kXQfHDVOjF7EYnr VXBs2HIxWdFwg0+kjycRrXIPdDXdCQEVm8SmU3LMhSsCjpxXejt8btytc9SHK4BLyRVx ybDXmIHFWVSXpBTQ2Z31/pF2X5mxYjOmq99N7JDzEtqiKBZhtUeYAWaDeqnIIY8v3ptH 8WRQ++zwL2ccriRb9KbG+HPOb8M492kdbMPvfTW9LZOm0xudb0TGOx5OxKWZ7EWL1f8y ogBQytlejBdfZcHC0z58rw4N+RKL5QSygxZNKmB8iOndkdA0bD7CleJ3LFm+VeorgFIR NmnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714622405; x=1715227205; 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=9G0PnPmWfaPJfpqHRvE0rSTyh8mID58ozqAZB3od5Rc=; b=DO8AMdSsdnRUQKc3DazKTvOIBOTRZpOBpZUfYW2Bm6nwZURuzJ7SAOJ4iLHrvzBUZY U5RUrtla8/fZaLoniJJI6e+RVuHe5gYMGRWg1Rn/7nmMtuo6kQLql7li8NeXsdVjmGvz as6criqwBCFtHHkpeb+gt/p3uY2bMJrsqJBD+HFeMDGL5gFPEbaH7h0HywEqLpTzZu73 U+krbURImlTN8Z2rj3YO06tVoFWlb6vWe4999Ht1q3rA4phYbCWKKR3JacsL8bQzRxNB 6p5DqZIq7+CpILOXrQdQLvbN+TxX3HKAiunEf3Jx7ePn05lSEpO/YM/FfwXEshVWq5xH EjCQ== X-Gm-Message-State: AOJu0YyZHEM18Vvvd2o0arXNqaV06PaICyfY9yUj5FBiDERVG+afnS14 +jNWuFN0yF8i8MoX4Bhn4OaX4kGhNms0sWxtnjhV3UXwjJeYsngm X-Google-Smtp-Source: AGHT+IH6Zi6qyHupZRZvV8ryuOkhBaBSWzTzcCBNcWEOY6w1exfJrO7/A33e8Ud2IbnkeLpBTT1r5w== X-Received: by 2002:a05:6512:282c:b0:519:33a5:973e with SMTP id cf44-20020a056512282c00b0051933a5973emr3195045lfb.6.1714622402432; Wed, 01 May 2024 21:00:02 -0700 (PDT) Received: from [1.0.0.7] ([178.155.23.194]) by smtp.gmail.com with ESMTPSA id r17-20020ac24d11000000b0051cb8bd331csm26325lfi.185.2024.05.01.21.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 May 2024 21:00:01 -0700 (PDT) Message-ID: <95a01e66-0c92-2ff6-b243-849ddd11685d@gmail.com> Date: Thu, 2 May 2024 07: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: BUG #18449: Altering column type fails when an SQL routine depends on the column Content-Language: en-US To: Tom Lane Cc: pgsql-bugs@lists.postgresql.org, Peter Eisentraut References: <18449-f8248467aaa294d5@postgresql.org> <403599.1714268901@sss.pgh.pa.us> <548a47bc-87ae-b3df-c6a2-60b9966f808b@gmail.com> <1944626.1714572523@sss.pgh.pa.us> From: Alexander Lakhin In-Reply-To: <1944626.1714572523@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 01.05.2024 17:08, Tom Lane wrote: > Hm. We could fix this by introducing another single-purpose error > report, but I'm starting to think that that's failing to learn from > experience. Who's to say that other column dependencies aren't > possible, now or in the future? The only thing stopping us from > treating the default: case as a normal ERRCODE_FEATURE_NOT_SUPPORTED > error is that it might be hard to phrase the error message in a nice > way. We already have a precedent for this being an acceptable > errdetail: > > ereport(ERROR, > (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), > errmsg("cannot alter type of a column used in a policy definition"), > errdetail("%s depends on column \"%s\"", > getObjectDescription(&foundObject, false), > colName))); > > It doesn't seem too awful to me to write the errmsg as > > errmsg("cannot alter type of a column used in a %s", > get_object_class_descr(foundObject.classid)), I agree, though by doing that we'll loose the ability to detect obviously wrong dependencies, say, when a role depends on a table column (if INTERNAL_ERRORs expected to be handled as something abnormal), but ATExecAlterColumnType() is hardly an appropriate place for such detection anyway. So I would sacrifice this ability to make this function simpler now and in the future. Best regards, Alexander