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 1ryqT8-000liA-SG for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Apr 2024 10:00:14 +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 1ryqT4-0015r4-RD for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Apr 2024 10: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 1ryqT4-0015qu-FN for pgsql-hackers@lists.postgresql.org; Mon, 22 Apr 2024 10:00:10 +0000 Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1ryqSx-002Jan-BQ for pgsql-hackers@lists.postgresql.org; Mon, 22 Apr 2024 10:00:09 +0000 Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2d9fe2b37acso56717001fa.2 for ; Mon, 22 Apr 2024 03:00:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713780002; x=1714384802; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=6iMLzaWwBt1SgorLNIr6eSwa7trN8A81La3xPxmUfGQ=; b=NRzsqJjuXjulEuWTzHnAtVBaLlzunQHQQStKytOEFPQ3gvPJYGJj3sTDqQrkRqwynQ nnSIHF9FFNMWOyXpbCOyA8c13Ttut60LDuca3KpP/faZYyBxS5hBrZEMnQJceRBCGfOP BTFJJUWOO08XU9j5++P3zYW1ujcqekN0gbhr6J+tPGSUvMX6tYbqdNjfDc5sP7kN4Bzl lanN/ipTICziS+HsTj/5u7pwTzr+8SlcceR+JJfNqmcvvH/4Zz6yO5KJ7EEODgoTiynh YxxTmVUwXYpdwL1zxtbXoOZzsTxKqu6KugAhJoOmEc6q/BZN9oOLct96G3z6yc4x70Hg IZfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713780002; x=1714384802; h=content-transfer-encoding:in-reply-to:from:references: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=6iMLzaWwBt1SgorLNIr6eSwa7trN8A81La3xPxmUfGQ=; b=LD5kUVtun/2R0Z9jwmmxvEBbs+waVJ6EyrBVIC6eVDCtGCq1joTGImzynHm+g/PUSe z0S9118hov4I3CH/QncqFPEUwj3xs3eU/gCvH/897pM7nmVqSxOBqbSRBF8ZM1w2nLuj 0MM0j+WJlW1hUQpm6H6T7dmSatxk4mGuld4X4cLJauv1bQZQqrV6czWQ8fojKoc92AsC 7bRfK8gPmy3Lz7/rPbqyuXHdVZS9t4i1rMPYVQE85A5zxAY0IGCYkNd9BQlBGzGLHOem 3zyraylY7vFwjstKE4kJkenLpnpDYoMUCQ7NF9prewhR07pm+IDdVixjd3Hn1XTKh/T6 FN7A== X-Forwarded-Encrypted: i=1; AJvYcCWp/PJ9tVxKV3Tq06z5l1A3fnB1tjj/iMsJ7rvTejSAAgxy+ifqyU2lgnntLX8tWYbCxw6z3HWkYFdpEOkJvETNPa+5XHIDMJcvrMaPL26MWFVu X-Gm-Message-State: AOJu0YwunKk+oQmo3W3by+jg4UBfilGj99b9aa/+i2HlmBUghm0hr4VO 3BVl4Q7twedIkpQyWAF2ItygRjsINGRW8Razc3Hj0BzPBrIiocg+ X-Google-Smtp-Source: AGHT+IF+ZLC62X+UHkintkD6g0j5CSfwNpOZq5yhWMWhy8D7QyY9Z8ocl/3mLdAEzd39B55q7c/oDw== X-Received: by 2002:a2e:9b4e:0:b0:2dd:2fc:3cd with SMTP id o14-20020a2e9b4e000000b002dd02fc03cdmr4386310ljj.29.1713780001568; Mon, 22 Apr 2024 03:00:01 -0700 (PDT) Received: from [1.0.0.7] ([178.155.16.75]) by smtp.gmail.com with ESMTPSA id t3-20020a2e9c43000000b002dcb831d958sm1213649ljj.56.2024.04.22.03.00.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 22 Apr 2024 03:00:01 -0700 (PDT) Message-ID: Date: Mon, 22 Apr 2024 13: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 , pgsql-hackers@lists.postgresql.org References: 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 Hi Bertrand, 22.04.2024 11:45, Bertrand Drouvot wrote: > Hi, > > This new thread is a follow-up of [1] and [2]. > > Problem description: > > We have occasionally observed objects having an orphaned dependency, the > most common case we have seen is functions not linked to any namespaces. > > ... > > Looking forward to your feedback, This have reminded me of bug #17182 [1]. Unfortunately, with the patch applied, the following script: for ((i=1;i<=100;i++)); do   ( { for ((n=1;n<=20;n++)); do echo "DROP SCHEMA s;"; done } | psql ) >psql1.log 2>&1 &   echo " CREATE SCHEMA s; CREATE FUNCTION s.func1() RETURNS int LANGUAGE SQL AS 'SELECT 1;'; CREATE FUNCTION s.func2() RETURNS int LANGUAGE SQL AS 'SELECT 2;'; CREATE FUNCTION s.func3() RETURNS int LANGUAGE SQL AS 'SELECT 3;'; CREATE FUNCTION s.func4() RETURNS int LANGUAGE SQL AS 'SELECT 4;'; CREATE FUNCTION s.func5() RETURNS int LANGUAGE SQL AS 'SELECT 5;';   "  | psql >psql2.log 2>&1 &   wait   psql -c "DROP SCHEMA s CASCADE" >psql3.log done echo " SELECT pg_identify_object('pg_proc'::regclass, pp.oid, 0), pp.oid FROM pg_proc pp   LEFT JOIN pg_namespace pn ON pp.pronamespace = pn.oid WHERE pn.oid IS NULL" | psql still ends with: server closed the connection unexpectedly         This probably means the server terminated abnormally         before or while processing the request. 2024-04-22 09:54:39.171 UTC|||662633dc.152bbc|LOG:  server process (PID 1388378) was terminated by signal 11: Segmentation fault 2024-04-22 09:54:39.171 UTC|||662633dc.152bbc|DETAIL:  Failed process was running: SELECT pg_identify_object('pg_proc'::regclass, pp.oid, 0), pp.oid FROM pg_proc pp       LEFT JOIN pg_namespace pn ON pp.pronamespace = pn.oid WHERE pn.oid IS NULL [1] https://www.postgresql.org/message-id/flat/17182-a6baa001dd1784be%40postgresql.org Best regards, Alexander