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 1moqug-0005i4-4c for pgsql-general@arkaria.postgresql.org; Sun, 21 Nov 2021 17:46: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 1moque-0001hp-3S for pgsql-general@arkaria.postgresql.org; Sun, 21 Nov 2021 17:46:00 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1moCvb-000188-Qo for pgsql-general@lists.postgresql.org; Fri, 19 Nov 2021 23:04:19 +0000 Received: from mailgw1.uni-kl.de ([2001:638:208:120::220]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1moCvZ-0004Es-4H for pgsql-general@postgresql.org; Fri, 19 Nov 2021 23:04:19 +0000 Received: from uni-kl.de (mail.uni-kl.de [131.246.120.212]) by mailgw1.uni-kl.de (8.14.4/8.14.4/Debian-8+deb8u2) with ESMTP id 1AJN4FiF110545 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-RC4-SHA bits=128 verify=NOT) for ; Sat, 20 Nov 2021 00:04:15 +0100 Received: from [131.246.235.204] (account hwang@rhrk.uni-kl.de) by rhrk.uni-kl.de (CommuniGate Pro XIMSS 6.3.7g) with HTTPU id 229849329; Sat, 20 Nov 2021 00:04:15 +0100 X-Mailer: Samoware HTML5 6.3.6255634 Subject: Error when rewriting a query into multiple queries MIME-Version: 1.0 Cc: h_wang21@informatik.uni-kl.de From: "Huang Wang" To: pgsql-general@postgresql.org Date: Sat, 20 Nov 2021 00:04:15 +0100 Message-ID: Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: 8bit X-Spam-Status: No, hits=0.731, tests=ALL_TRUSTED=-1,DEAR_SOMETHING=1.731 X-Spam-Score: (0.731) X-Spam-Flag: NO List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Dear Sir or Madam, I'm trying to add progressive query into Postgres. Assume a query 'SELECT * FROM hugetable', my idea is to rewrite it into several queries as 'SELECT * FROM hugetable TABLESAMPLE SYSTEM_TIME(500)' 'SELECT * FROM hugetable TABLESAMPLE SYSTEM_TIME(1000)' 'SELECT * FROM hugetable TABLESAMPLE SYSTEM_TIME(1500)' the first query will provide real-time results to the user and the following queries will return later for more accurate results. However, I got a '[42601]: ERROR: cannot insert multiple commands into a prepared statement' error after I modified postgres.c or parser.c. Is there any way to do it on the server or it's better to do it in the application? Thank you for your help. Best regards, Wang