DO Statement Body Parameters

Поиск
Список
Период
Сортировка
От David Johnston
Тема DO Statement Body Parameters
Дата
Msg-id 00b001cbe9bb$0ecca580$2c65f080$@yahoo.com
обсуждение исходный текст
Ответы Re: DO Statement Body Parameters  (Willy-Bas Loos <willybas@gmail.com>)
Список pgsql-general
I think I understand what is happening but am curious if something along
these lines can be accomplished?
Consider the following SQL statement (executed via JDBC against a 9.0.3
installation):

DO $$ BEGIN PERFORM someexistingfunction ( ? ); END; $$

It appears that such a format is invalid since JDBC will not provide any
parameter hooks and as written the SQL parser does not like the unquoted
question mark (it works fine with real values in place of the '?').

My guess is that the anonymous function created by DO is immediately
"compiled" and thus the placeholder never gets a chance to be replaced with
a real value.

Given that you cannot place function parameters onto the DO statement (i.e.,
DO (varchar, varchar) $$  $$;) the only way to use DO is to build the full
SQL by hand and introduce possible SQL Injection weaknesses into the system.

Is this a conscious design decision in order to address the complexity of
making a DO statement possible at all or is it an oversight that is or could
be planned for future correction?  Or should it work except for some
limitation of JDBC?  I am not sure how I'd go about testing a parameterized
query without using JDBC...

Thanks

David J.







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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: Linux, Hungarian charset (Win1250) is supports the hungarian collation?
Следующее
От: hyelluas
Дата:
Сообщение: Re: constraint partition issue