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 1ikUdL-0007b0-Mb for pgsql-general@arkaria.postgresql.org; Thu, 26 Dec 2019 15:01:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ikUdK-0007Da-AA for pgsql-general@arkaria.postgresql.org; Thu, 26 Dec 2019 15:01:02 +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 1ikUdK-0007BO-15 for pgsql-general@lists.postgresql.org; Thu, 26 Dec 2019 15:01:02 +0000 Received: from mailbackend.panix.com ([166.84.1.89]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ikUdH-0006Gf-GR for pgsql-general@lists.postgresql.org; Thu, 26 Dec 2019 15:01:01 +0000 Received: from panix5.panix.com (panix5.panix.com [166.84.1.5]) by mailbackend.panix.com (Postfix) with ESMTP id 47kCnj64VtznrN; Thu, 26 Dec 2019 10:00:57 -0500 (EST) Received: by panix5.panix.com (Postfix, from userid 17622) id 47kCnj592dzfYc; Thu, 26 Dec 2019 10:00:57 -0500 (EST) Date: Thu, 26 Dec 2019 10:00:57 -0500 From: stan To: Tom Lane Cc: pgsql-general@lists.postgresql.org Subject: Re: What am I doing wrong here? Message-ID: <20191226150057.GC21962@panix.com> References: <20191226133639.GA15506@panix.com> <17328.1577369163@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <17328.1577369163@sss.pgh.pa.us> 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 On Thu, Dec 26, 2019 at 09:06:03AM -0500, Tom Lane wrote: > stan writes: > > When I try to insert this function I get an error on the following line: > > _bom_name_key = ( SELECT > > I actually pretty much get a syntax error whatever is at this line. > > Can someone please explain what I am doing wrong? > > I think you're misunderstanding where to put the WITH. That's just > part of the SQL statement as far as plpgsql is concerned, so what > you need to do to use a WITH clause in a variable assignment is > to write > > variable := WITH ... SELECT ... ; > > (At least, I think that will work; what you're doing definitely > won't.) Thanks, that was my mistake. -- "They that would give up essential liberty for temporary safety deserve neither liberty nor safety." -- Benjamin Franklin