Re: BUG #2228: escaped single quotes choke spi_exec_query in plperlu

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #2228: escaped single quotes choke spi_exec_query in plperlu
Дата
Msg-id 410.1138807588@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #2228: escaped single quotes choke spi_exec_query in plperlu  ("Michael Lush" <michael@galton.ucl.ac.uk>)
Ответы Re: BUG #2228: escaped single quotes choke spi_exec_query in  (michael <michael@galton.ucl.ac.uk>)
Список pgsql-bugs
"Michael Lush" <michael@galton.ucl.ac.uk> writes:
> CREATE OR REPLACE FUNCTION quote_bug(text) RETURNS text AS
> $$
>    $data = $_[0];

>    $sql = "SELECT *
>              FROM test
>             WHERE foo = '$data'";

>    $rv_unique = spi_exec_query($sql);

It's hardly a bug that you get a syntax error when $data contains
a single quote.  It's up to you to construct a well-formed query
string to give to spi_exec_query, and this code is not doing that.

            regards, tom lane

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #2225: Backend crash -- BIG table
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #2229: Parsing error in Functions Grant Wizard