Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pC6ww-0002Ra-0P for pgsql-hackers@arkaria.postgresql.org; Sun, 01 Jan 2023 22:37:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pC6wt-0002vH-1X for pgsql-hackers@arkaria.postgresql.org; Sun, 01 Jan 2023 22:36:59 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pC6ws-0002uw-Dm for pgsql-hackers@lists.postgresql.org; Sun, 01 Jan 2023 22:36:58 +0000 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pC6wp-0000id-Im for pgsql-hackers@lists.postgresql.org; Sun, 01 Jan 2023 22:36:57 +0000 Received: by mail-wm1-x335.google.com with SMTP id k22-20020a05600c1c9600b003d1ee3a6289so19305819wms.2 for ; Sun, 01 Jan 2023 14:36:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=QSebloOSwCBZY1032PFwPQ8PpPo2f79f2Bp1QMCnClo=; b=DkPjPBXMNMaLKqAzgZU9aK64WVacu1spFbuuH3X/SlOVlK/Jt62oePioRJvHLAQ3AE ZSsFGJ+fFRPaCkohe5JqKb3pekAq1v7pegHM3CgEZFnRP/GQLzAed3b9/E4Of3Thruhs Hj1tnN+pdGSIee07Bza532KLSjCwsGuu8FpS4z3ZIl4TMZAbjye57mrepp3oEfAWDNN3 SYBUY1lbqv62X8L7p7mb+FMt9wKA3EqihZKhnaVR/j9LwiQ/Dyr6Ycnn7jwwVsCZDLpf 45GjBxqlqPGi65PJbJUx8IIihDTXw2tC++kwvN53dQEtdDOUBDAnCGCrF2CVWOeWjTnp tifg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=QSebloOSwCBZY1032PFwPQ8PpPo2f79f2Bp1QMCnClo=; b=6732b2uIROrBi1IpnAw62rMqLeWHkxv0Phw2l/KG05rtzTUyxpWHZfr7d0+XRGXzS5 iL9NYNEm7fdrxFE7WGWY3H/TrMl1K+VFM/DCQnRMb75/vA29sHHyE82/ZNT1/poY9iu1 gq9hJCERgXTFOKZzyREifsLh13kVxHum1H/Weyw2MRJ6AKk9rXRRiQxMW0izV0K9NkW3 TwaHXAbGNAKExlPxSBDUPeN3i99BBP2inz0jbnR03hW4xzwPk/EKCxwwH1ufXin6cPEe sSFmehijqHrHVZZs8Crllf+izKKghrDGKyEgHNsNoHxSTrKqqaqsbCCIstao4m8M0h6j RmYg== X-Gm-Message-State: AFqh2ko+3f+8cUNSFWx/ibFhSrMxuyAijlkAKHD9QGKDUp4l4CWe8c/G oHkReJocTIheSc/kfmwqxE5xq1B22MkBb0WPxhxCyFTIi5CWzHkT5KwHKBFonEInkfwMuHojKAE V2tgD+PgxNlQy4NfDEwU1i69gwRZkQFx2CQ18k5rdReh7PMGPu0eP+5g6u/EBJlIwbZJlhr5cS7 jCovPoFZfQ7xrnVHlAop60aFPoMw7+gg3DgeyByGeZhunUJwqxjfKIMemaP5Y4wNcbinfW4dUFU P9v7Hk+Ew3K1xtbWTuVV91it22hbvAhTCkhiCdWwTqem6Hu+iAsAk3IfDZE X-Google-Smtp-Source: AMrXdXs+qGEDPqR6dkPMs1hzF3NsGxxr0PdJOZzrhsC4PVcyJjrkCPq3QAtwcTaNA4ehd49oVqf6Bg== X-Received: by 2002:a05:600c:4920:b0:3cf:7514:a82e with SMTP id f32-20020a05600c492000b003cf7514a82emr27987226wmp.23.1672612613254; Sun, 01 Jan 2023 14:36:53 -0800 (PST) Received: from [10.137.0.17] (ip-86-49-226-124.bb.vodafone.cz. [86.49.226.124]) by smtp.gmail.com with ESMTPSA id o8-20020a05600c4fc800b003d99a39b846sm17850292wmq.5.2023.01.01.14.36.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 01 Jan 2023 14:36:52 -0800 (PST) Message-ID: Date: Sun, 1 Jan 2023 23:36:49 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: postgres_fdw: using TABLESAMPLE to collect remote sample To: Tom Lane Cc: James Finnerty , pgsql-hackers@lists.postgresql.org References: <151e835f-55d6-ddbc-b5b4-07ee606aba44@enterprisedb.com> <03182011-10a4-97b4-7c70-d99aa1c11eed@enterprisedb.com> <167112207543.1120.12195641719862911275.pgcf@coridan.postgresql.org> <3377008.1671122816@sss.pgh.pa.us> <6da357b0-fdd3-095d-a06c-87666f4a5a8c@enterprisedb.com> <951485.1672461744@sss.pgh.pa.us> <233ee0b3-4da0-3370-cd0b-1b8528851ddd@enterprisedb.com> <1040922.1672507431@sss.pgh.pa.us> Content-Language: en-US From: Tomas Vondra In-Reply-To: <1040922.1672507431@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 12/31/22 18:23, Tom Lane wrote: > Tomas Vondra writes: >> On 12/31/22 05:42, Tom Lane wrote: >>> ERROR: TABLESAMPLE clause can only be applied to tables and materialized views >>> I think the patch avoids that, but only accidentally, because >>> reltuples will be 0 or -1 for a view. Maybe it'd be a good >>> idea to pull back relkind along with reltuples, and check >>> that too? > >> Not sure. I guess we can rely on reltuples being 0 or -1 in such cases, >> but maybe it'd be good to at least mention that in a comment? We're not >> going to use other reltuples values for views etc. > > Would anyone ever point a foreign table at a sequence? I guess it > would be a weird use-case, but it's possible, or was till now. > Yeah, it's a weird use case. I can't quite imagine why would anyone do that, but I guess the mere possibility is sufficient reason to add the relkind check ... regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company