Re: proof concept: do statement parametrization

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: proof concept: do statement parametrization
Дата
Msg-id AANLkTik-DeZ2op2JGxj206gGyy8cgL_d-WH6E6rYhjV1@mail.gmail.com
обсуждение исходный текст
Ответ на Re: proof concept: do statement parametrization  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
2010/7/4 Andres Freund <andres@anarazel.de>:
> On Sun, Jul 04, 2010 at 11:38:47AM -0400, Andrew Dunstan wrote:
>>
>>
>> Pavel Stehule wrote:
>> >>BTW, we intentionally didn't put any provision for parameters into DO
>> >>originally.  What's changed to alter that decision?
>> >>
>> >
>> >It just concept - nothing more. And my instinct speak so inline code
>> >block without external parametrization is useless.
>> >
>> >
>>
>> You have said this before, IIRC, but frankly your instinct is just
>> wrong. It is no more useless than are parameter-less functions, and
>> I use those frequently. I used a DO block for some useful testing
>> just the other day.
> In my opinion its even *more* useful than parameterless
> functions. In many cases you will use DO to write upgrade scripts or
> ad-hoc code.
> In both cases its not really much of diference whether you write the
> parameter inside the function or outside (as a parameter to it) and
> escaping is not a critical part anyway.
>
> So maybe I am missing the point of this discussion?

when the parameter are not outside, then they are not accessable from
psql. psql's variable expansion isn't working inside code literal. So
you have not any way to put some external parameters - for example -
when I would to prepare scripts for administration of databases for
some user - cleaning schema, preparing schema, etc, then I have to
write username directly to script. I cannot use a possibility of psql
to specify variables.

Regards

Pavel

>
> Andres
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>


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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: proof concept: do statement parametrization
Следующее
От: Florian Pflug
Дата:
Сообщение: Re: proof concept: do statement parametrization