plperl syntax question - Mailing list pgsql-general

From stan
Subject plperl syntax question
Date
Msg-id 20200312223402.GA613@panix.com
Whole thread Raw
Responses Re: plperl syntax question
Re: plperl syntax question
List pgsql-general
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



pgsql-general by date:

Previous
From: Ron
Date:
Subject: Re: Migrating from Db2
Next
From: Rob Sargent
Date:
Subject: Re: plperl syntax question