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.92) (envelope-from ) id 1jCWP3-0008FV-Ty for pgsql-general@arkaria.postgresql.org; Thu, 12 Mar 2020 22:34:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jCWP1-0000Sf-D1 for pgsql-general@arkaria.postgresql.org; Thu, 12 Mar 2020 22:34:07 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jCWP1-0000SY-0V for pgsql-general@lists.postgresql.org; Thu, 12 Mar 2020 22:34:07 +0000 Received: from mailbackend.panix.com ([166.84.1.89]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jCWOy-0002QU-Jz for pgsql-general@lists.postgresql.org; Thu, 12 Mar 2020 22:34:05 +0000 Received: from panix5.panix.com (panix5.panix.com [166.84.1.5]) by mailbackend.panix.com (Postfix) with ESMTP id 48dkBy5rJ2z1DhD for ; Thu, 12 Mar 2020 18:34:02 -0400 (EDT) Received: by panix5.panix.com (Postfix, from userid 17622) id 48dkBy4y1ZzfYm; Thu, 12 Mar 2020 18:34:02 -0400 (EDT) Date: Thu, 12 Mar 2020 18:34:02 -0400 From: stan To: pgsql-general@lists.postgresql.org Subject: plperl syntax question Message-ID: <20200312223402.GA613@panix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Editor: gVim List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I am trying to run a query in plperl that uses a Perl variable from the same function. Here is the code snippet: my $stmt = qq("SELECT employee_key from employee where id = '$user' ;"); elog( NOTICE, "stmt = $stmt" ); my $rv3 = spi_exec_query('$stmt'); Here is the runtime output: NOTICE: stmt = "SELECT employee_key from employee where id = 'stan' ;" ERROR: syntax error at or near "$" at line 22. As you can see, the statement seems correctly formatted, right? What am I doing wrong here? -- "They that would give up essential liberty for temporary safety deserve neither liberty nor safety." -- Benjamin Franklin