Re: plperl syntax question - Mailing list pgsql-general

From David G. Johnston
Subject Re: plperl syntax question
Date
Msg-id CAKFQuwabpY3g9gehx1=-bW+Ot6m1vMsETXZQLXWZv7jD=zZvcA@mail.gmail.com
Whole thread Raw
In response to Re: plperl syntax question  (Rob Sargent <robjsargent@gmail.com>)
List pgsql-general
On Thursday, March 12, 2020, Rob Sargent <robjsargent@gmail.com> wrote:

The example I saw for qq on the perl site 
print(qq(Welcome to GeeksForGeeks));
doesn’t have any quotes in arg to qq

Correct.  It also says:

qq() operator in Perl can be used in place of double quotes. It uses a set of parentheses to surround the string.

Try making the sql string without using qq
my $select = “select....’” + $user + “‘;”;
(or perhaps perl has a formatted string function like printf)

This is worse than using correctly.
 
The OP should (I think) be using a parameterized query instead of brute force string manipulation since this code is a prone to exploit.

David J.

pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: plperl syntax question
Next
From: Deepti Sharma S
Date:
Subject: RE: PostgreSQL10.x client Vs. PostgreSQL 11.x server