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 1s1qpt-00FP3a-Ry for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Apr 2024 17:00:09 +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 1s1qpr-007E9j-B7 for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Apr 2024 17:00:08 +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 1s1qpr-007E9a-1N for pgsql-hackers@lists.postgresql.org; Tue, 30 Apr 2024 17:00:07 +0000 Received: from mail-lj1-x235.google.com ([2a00:1450:4864:20::235]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1s1qpn-000sSU-Iq for pgsql-hackers@lists.postgresql.org; Tue, 30 Apr 2024 17:00:07 +0000 Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2d8a24f8a3cso74047921fa.1 for ; Tue, 30 Apr 2024 10:00:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714496402; x=1715101202; 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=rFFHc41zYDDEun81ES+3Kwy1yQjYdiLaddXW5Ofrib8=; b=RvUFvttlPTeQOohHKVf6S7PgxTxPh+PES3urGug5vJdO1+GAMbxv9U9aF2JAFIz8m6 2honm1pgNqgBKT030+taX9tTK2+AUqETPwWj+6L8MEhAT36CSNka622vrWBio1uf3yEs uaWCaLX/0/W2QwaJfQmymU9E8h/3LEv/BCtMk08dJezE3+GzqYeWXU6BvI+9wl9hYGP2 IDXC7ygRxhGinbqvQY8wD5GJxC5Cg1DEV/FTLazL5kKK5jcmqYFM7s2GbmV5AnYwBV2e DdLyJBucR3CmNS4MmiLHH0qP+GymE2Mu69xk8qw5oboIs+a8Z19ViBOeLnT5nD7PZWUf uRvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714496402; x=1715101202; 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=rFFHc41zYDDEun81ES+3Kwy1yQjYdiLaddXW5Ofrib8=; b=t21TbABo+e6mpkX+UsRd3JuddTpdQIu87egjHBbMJ7GPE50ZaWnIKUVusBHh4XJZth 6GzTj4kOyEdXaiOmjYrzctMlZrR/eSsBfGsZ+BjHhW9oXpQYEPyLHKxdC9fGiriH97Tn Rpg8z3td3dOSy+a11Ds+H069aCQsf43ylXDccZjhMWu8QeLwdi5uEat6BgJfyyKG58xU VcIxQtPh+BdmI26QuqwGchXMvROkaU64YWxg5v67bBy34A7UyWxaPjF9TH5jPTR7//8l HksvUOzHG9lreet0j8nxGaYJU4gQhryQG3H1EuTw7FAM1XwlM8QIDK/lwQEtTyflxgNf 7Hmw== X-Gm-Message-State: AOJu0YyrcJhtaCqF1dix1YMYpGignZLzTZd6gmkAdFe5bLNTaU/V2Cey gCQt1YjsIzJEOrwzIBxMcGBxrkiRAtCiWoh0Nj4ygM7Y/HvOMwfz X-Google-Smtp-Source: AGHT+IH9ogmzX97m+CQe2WbpaY0DVDdfO36r6mjVDMAXC49MZxNd9ffE9oFOU/KTmaf3Mt2xV3HdIg== X-Received: by 2002:a2e:a3d2:0:b0:2d8:a921:dfc1 with SMTP id w18-20020a2ea3d2000000b002d8a921dfc1mr194758lje.20.1714496402192; Tue, 30 Apr 2024 10:00:02 -0700 (PDT) Received: from [1.0.0.7] ([178.155.23.194]) by smtp.gmail.com with ESMTPSA id k24-20020a05651c10b800b002de47101c98sm2394354ljn.16.2024.04.30.10.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 30 Apr 2024 10:00:01 -0700 (PDT) Message-ID: Date: Tue, 30 Apr 2024 20: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 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 Hi Bertrand, 25.04.2024 10:20, Bertrand Drouvot wrote: > postgres=# CREATE FUNCTION f() RETURNS int LANGUAGE SQL RETURN f() + 1; > ERROR: cache lookup failed for function 16400 > > This stuff does appear before we get a chance to call the new depLockAndCheckObject() > function. > > I think this is what Tom was referring to in [1]: > > " > So the only real fix for this would be to make every object lookup in the entire > system do the sort of dance that's done in RangeVarGetRelidExtended. > " > > The fact that those kind of errors appear also somehow ensure that no orphaned > dependencies can be created. I agree; the only thing that I'd change here, is the error code. But I've discovered yet another possibility to get a broken dependency. Please try this script: res=0 numclients=20 for ((i=1;i<=100;i++)); do for ((c=1;c<=numclients;c++)); do   echo " CREATE SCHEMA s_$c; CREATE CONVERSION myconv_$c FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8; ALTER CONVERSION myconv_$c SET SCHEMA s_$c;   " | psql >psql1-$c.log 2>&1 &   echo "DROP SCHEMA s_$c RESTRICT;" | psql >psql2-$c.log 2>&1 & done wait pg_dump -f db.dump || { echo "on iteration $i"; res=1; break; } for ((c=1;c<=numclients;c++)); do   echo "DROP SCHEMA s_$c CASCADE;" | psql >psql3-$c.log 2>&1 done done psql -c "SELECT * FROM pg_conversion WHERE connamespace NOT IN (SELECT oid FROM pg_namespace);" It fails for me (with the v4 patch applied) as follows: pg_dump: error: schema with OID 16392 does not exist on iteration 1   oid  | conname  | connamespace | conowner | conforencoding | contoencoding |      conproc      | condefault -------+----------+--------------+----------+----------------+---------------+-------------------+------------  16396 | myconv_6 |        16392 |       10 |              8 |             6 | iso8859_1_to_utf8 | f Best regards, Alexander