Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iKNFa-0004BT-A8 for pgsql-general@arkaria.postgresql.org; Tue, 15 Oct 2019 13:52:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iKNFY-0000Ai-S7 for pgsql-general@arkaria.postgresql.org; Tue, 15 Oct 2019 13:52:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iKNFY-0000AZ-Ih for pgsql-general@lists.postgresql.org; Tue, 15 Oct 2019 13:52:32 +0000 Received: from mailbackend.panix.com ([166.84.1.89]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iKNFR-00057I-SG for pgsql-general@lists.postgresql.org; Tue, 15 Oct 2019 13:52:32 +0000 Received: from panix2.panix.com (panix2.panix.com [166.84.1.2]) by mailbackend.panix.com (Postfix) with ESMTP id 46sxgr2vRjz1ZPP for ; Tue, 15 Oct 2019 09:52:24 -0400 (EDT) Received: by panix2.panix.com (Postfix, from userid 17622) id 46sxgr1ZwTz1ZVj; Tue, 15 Oct 2019 09:52:24 -0400 (EDT) Date: Tue, 15 Oct 2019 09:52:24 -0400 From: stan To: pgsql-general@lists.postgresql.org Subject: Inserting multiple rows wtih a SELECt in the values clause Message-ID: <20191015135224.GA3910@panix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Editor: gVim User-Agent: Mutt/1.12.1 (2019-06-15) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk OK, now that figured out how to return the constant, this is the final query I need to run. INSERT into rate ( employee_key , project_key , work_type_key , rate ) VALUES ( ( SELECT employee.employee_key , project.project_key , work_type.work_type_key , 1 as rate FROM employee CROSS JOIN project CROSS JOIN work_type ) ); But this fails. I suspect this may be because the SELECT in the values clause returns multiple rows? -- "They that would give up essential liberty for temporary safety deserve neither liberty nor safety." -- Benjamin Franklin