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 1kYB3b-00043T-VE for pgsql-general@arkaria.postgresql.org; Thu, 29 Oct 2020 16:45:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kYB3a-0003A8-QP for pgsql-general@arkaria.postgresql.org; Thu, 29 Oct 2020 16:45:46 +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 1kYB3Z-00039i-9P for pgsql-general@lists.postgresql.org; Thu, 29 Oct 2020 16:45:46 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kYB3V-0006t7-Sp for pgsql-general@lists.postgresql.org; Thu, 29 Oct 2020 16:45:44 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 4F48F92C; Thu, 29 Oct 2020 12:45:39 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 29 Oct 2020 12:45:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=R OdNoSslF8iotOj87dLJitQbqo4+rwp10lt65AkRJj0=; b=du8Q4YHJpuY/CciYR hT4JM0lYFFQrNQIX/ZcbGdk/KmUAhZ77iGYzmZ1/rgkIEx0UYYgXARqn2Ej1Vfji xTrhbrYxA192bLnkbaHQ2+Gy/LzTPaGIl9L4xlMxBKTAZg/QphZ2r+oUamcTpy5o 34s4rlBM6sBJ4MBJkgh6wCr6jzN8cPWYezQPDeEIhKO517T6igFgTmLS+QCe0WRC SIPEXAcpUG0ng5Cb8Tq8Zj+GjedhQL35hI6GrTG7nuwPNfcutJNh+A1JymzETHLg cwjZkX1LBfAqENW1YGcK2n8BusOGxP+72rWEqITXRTvHD4d5VLIpwY1b66J2hUMv 8gB3g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=ROdNoSslF8iotOj87dLJitQbqo4+rwp10lt65AkRJ j0=; b=lhGUBm49c12okrXl9mHDIsds/VmMfvsuXVUs8OR9SmU/9kGKsZFWzo4zD KVZuOx/kIaXwBPsgCEwLJHGjFhD24XNYImz10Sv9A7gLiOZbMy9zAt1Ll7VzM33r of29eMnt/1ZlH63gEKCXjJ8E+rk0jdIJyRzbtLW0gWs+0iu1VCfrPHCy4QE/iIO+ oOexAExIe8VHC3FdpDDQK064NSKAihTsFe736IJ86/lCYMwY20/+5b/SeFs8naKG ASdS6Ffu39EzqWvICp9KoZpbh+L7n5nqGZHCemFmzXazOrlLQlM6N5cbWV4Q4Rfy 3vZGn7mNvfsIbY7a6fqGSGmBlF3hg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleefgdeludcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefuvfhfhffkffgfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeetughrihgr nhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh eqnecuggftrfgrthhtvghrnhepveevfeevfeeugeffkeekhfegieeufffgteeujedvgffh ueejjefhkeejleegtdegnecukfhppeejhedrudejvddrudelrddufeelnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgr vhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Received: from [192.168.1.4] (75-172-19-139.tukw.qwest.net [75.172.19.139]) by mail.messagingengine.com (Postfix) with ESMTPA id 506A93064682; Thu, 29 Oct 2020 12:45:38 -0400 (EDT) Subject: Re: Multi-row insert: error at terminal row. To: Rich Shepard , PostgreSQL General References: <712da077-deec-6787-2ef0-3e668acfbc17@gmail.com> <6FE34808-28CE-4550-9BC4-A70D91503D2C@gmail.com> <23EFF7D8-D708-4F5F-826C-A7FB0F7C265A@gmail.com> From: Adrian Klaver Message-ID: Date: Thu, 29 Oct 2020 09:45:37 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 10/29/20 9:35 AM, Rich Shepard wrote: > On Thu, 29 Oct 2020, Paul Förster wrote: > >> insert ... >> ( >>    (v1, v2, v3), >>    (v4, v5, v6), >>    (v7, v8, v9)    <= this is the bracket pair that Emacs shows as >> matching. >> );     <= this is the missing bracket. > > Paul/Adrian/Tom: > > First thing I did was look at the postgres 12 manual. On page 155 I see: > > You can insert multiple rows in a single command: > INSERT INTO products (product_no, name, price) VALUES >     (1, 'Cheese', 9.99), >     (2, 'Bread', 1.99), >     (3, 'Milk', 2.99); > > Which is what I have. There are no extra parentheses enclosing multiple > rows > of VALUES. But, adding them makes no difference: same error reported. If you did something like: INSERT INTO products (product_no, name, price) VALUES ( (1, 'Cheese', 9.99), (2, 'Bread', 1.99), (3, 'Milk', 2.99) ); then you should have gotten a different error. Something like: ERROR: column "product_no" is of type integer but expression is of type record I'm going to say the issue is more like what David posted, an escaping problem in the data. Not sure how many rows you are dealing with, but it might be helpful to break them down into smaller batches to isolate the problem. > > Thanks, > > Rich > > -- Adrian Klaver adrian.klaver@aklaver.com