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.96) (envelope-from ) id 1wNMT7-000kbY-0g for pgsql-hackers@arkaria.postgresql.org; Thu, 14 May 2026 03:10:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wNMT5-00Aefh-2Y for pgsql-hackers@arkaria.postgresql.org; Thu, 14 May 2026 03:10:35 +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.96) (envelope-from ) id 1wNMT5-00AefY-1g for pgsql-hackers@lists.postgresql.org; Thu, 14 May 2026 03:10:35 +0000 Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wNMT2-00000000V0z-3DQ7 for pgsql-hackers@postgresql.org; Thu, 14 May 2026 03:10:34 +0000 Received: by mail-ot1-x333.google.com with SMTP id 46e09a7af769-7dbccf6a23dso6132132a34.2 for ; Wed, 13 May 2026 20:10:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778728231; x=1779333031; darn=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=ejFmSsZWlCQFfIPzbSZulsxgPYq3ICPnbGv2tgLlhys=; b=BspSpPWylRtUoskQQUZzm6BGRPSQR0CuEV6Ju4Zjm/vef3sBV0o/sJiUKB7WjIUkVq Tt8mUREA1KJYIKzplKkqyo9l6Q+X3NZQeVKlsWc65GNNZcr3XgdR5tJXDP+rxKHWyU1O VOM304skiorn6K6A+0n7CcYYRPFTtosBtRCNZdXPF6kifSMeMYpqrBZF6zlF8/DJULm3 HPi3oYCzVYX2QqxPs+nfj3/5MNoTi5/UuU0ozra/DY4fJFFVnAevMA8Do67xWNxLQAfw H3JzqGKcjgvK3eG1nrfHwXDfuRMBwOilKJ0/ZtxDQQ8+csFkPzkqUH3w7G1ShuUlJlD5 kcuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778728231; x=1779333031; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ejFmSsZWlCQFfIPzbSZulsxgPYq3ICPnbGv2tgLlhys=; b=JiwVKLPIWP2Lth1gLYYkKYicpBfcTcs7AR+CP7EnRlCKOJzMuyvL9UlDrnMO6lrE3Z SP6Kty6hHlRUHJNan68kFzMIkteUFrxq29Qs6e3sxnsU14hY1bsucCcb+iXwlWsxXAoI czo25MU++QvjVTDmVxV6hTKBxCcRGCC+mnK+hUt9qyx0zL0AmNDzFkkP3dr+bOcQq6Da +aKPkDDYB30d+LcJU36T1KzjCRO1jjUwbTcvBWUCkRDoL0Yn16f3qRctUXvDwl9uczE6 ZIiZS3j5kXtvxygSF39aQSCJG9m/6KxakPvQZuheFY35JiKlQDJpx6Y4r6tAHtzZShil TAFA== X-Gm-Message-State: AOJu0YzDGzfLz7oXS8pxHMb5crPgbebF0SCLt/F6QP192X6FgWlmvoq9 Znvw7y8GB5sCrnaJlMJsy4/VpgZLTY/upSswikFnj593uLojnSfLI5JqZF0WAg== X-Gm-Gg: Acq92OGoIASvQOL7dS/DWAMc9Kyv1BjbGzz2coCos9CVg/JJU96R2V4pNfU/iF5F7vu ECq1z4FSWK68UmyxkWLFXMZs6lVLDk2klp9JrddHnjBPodnDeq695zUsgpHHYlr3P/gXKnxRdCE Kvf0cHeS9khvcOclTV2hOSuNoY0mriXlSYL3OW2a7GZCqiQ7qrmshVVkbp7sx9EaW0HhVgCitRw 0cPSHcYbt2MbycNfj9xiOm8K5ZFoPPwoxWEUaXrA90L3VazR2kpsIG2UWjbGoSOceqF0pbo6UqC D5AMeFf5kB9i+yMaLdb4a7XkrNfzHr7u7+foB35ofJmsOL9AwZqfz7pD2XPjnZC0YnYMoozZUf0 OEDArBdEfoGVy6CNlfIiI9bjySoGP5Ca4vDdoPeM04GeyjyGXjgKYdGbUBdpNIGLf6f7ALrM168 eMNRW5nSgwSdr4UPBG/NBEddKS61/jq2AMImn/Ozyl+XkEM1rUFeVPJk9WS2iyM6a1MobmCif8O tX3v3Nj51iVO8fy66P+Fg== X-Received: by 2002:a05:6830:4708:b0:7dc:1615:7b52 with SMTP id 46e09a7af769-7e3da7daf94mr3688279a34.26.1778728231212; Wed, 13 May 2026 20:10:31 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7e3f398e1d8sm1072025a34.10.2026.05.13.20.10.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2026 20:10:30 -0700 (PDT) Date: Wed, 13 May 2026 22:10:28 -0500 From: Nathan Bossart To: Shawn McCoy Cc: pgsql-hackers@postgresql.org Subject: Re: Vacuumlo improvements Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="K++Jp4URl2Oj0VAw" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --K++Jp4URl2Oj0VAw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, May 12, 2026 at 10:00:15PM -0500, Nathan Bossart wrote: > Commit 64c604898e added the note about domains to the docs. Unfortunately, > neither that nor the corresponding thread [0] offer any clues as to why > vacuumlo doesn't resolve domains. The commit history for vacuumlo has been > pretty quiet for a long time, so maybe it's just been overlooked. It seems to be relatively easy to teach vacuumlo to handle domains over oid. Note that you need a recursive query because you can have domains over domains. Please test it out. I noticed that vacuumlo's tests are pretty sad, so this might be a good opportunity to change that. -- nathan --K++Jp4URl2Oj0VAw Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0001-teach-vacuumlo-to-handle-domains-over-oid.patch From f27e9a4606777c41cb41a9e71ede56384b79be84 Mon Sep 17 00:00:00 2001 From: Nathan Bossart Date: Wed, 13 May 2026 22:05:02 -0500 Subject: [PATCH v1 1/1] teach vacuumlo to handle domains over oid --- contrib/vacuumlo/vacuumlo.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/contrib/vacuumlo/vacuumlo.c b/contrib/vacuumlo/vacuumlo.c index 8102569466b..230f6958fc1 100644 --- a/contrib/vacuumlo/vacuumlo.c +++ b/contrib/vacuumlo/vacuumlo.c @@ -191,13 +191,25 @@ vacuumlo(const char *database, const struct _param *param) * delete... */ buf[0] = '\0'; + if (PQserverVersion(conn) >= 140000) + strcat(buf, "WITH RECURSIVE cte AS " + "(SELECT oid AS oid2, oid, typname, typbasetype FROM pg_type " + "UNION ALL " + "SELECT t2.oid2, t.oid, t.typname, t.typbasetype FROM pg_type t " + "JOIN cte t2 ON t.oid = t2.typbasetype) "); strcat(buf, "SELECT s.nspname, c.relname, a.attname "); strcat(buf, "FROM pg_class c, pg_attribute a, pg_namespace s, pg_type t "); + if (PQserverVersion(conn) >= 140000) + strcat(buf, ", cte "); strcat(buf, "WHERE a.attnum > 0 AND NOT a.attisdropped "); strcat(buf, " AND a.attrelid = c.oid "); strcat(buf, " AND a.atttypid = t.oid "); strcat(buf, " AND c.relnamespace = s.oid "); - strcat(buf, " AND t.typname in ('oid', 'lo') "); + if (PQserverVersion(conn) >= 140000) + strcat(buf, " AND t.oid = cte.oid2 " + " AND cte.typname = 'oid' "); + else + strcat(buf, " AND t.typname in ('oid', 'lo') "); strcat(buf, " AND c.relkind in (" CppAsString2(RELKIND_RELATION) ", " CppAsString2(RELKIND_MATVIEW) ")"); strcat(buf, " AND s.nspname !~ '^pg_'"); res = PQexec(conn, buf); -- 2.50.1 (Apple Git-155) --K++Jp4URl2Oj0VAw--