Re: EXECUTE USING for plpgsql (for 8.4)

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: EXECUTE USING for plpgsql (for 8.4)
Дата
Msg-id 162867790710231457m7aa12779o24049752a53d1854@mail.gmail.com
обсуждение исходный текст
Ответ на Re: EXECUTE USING for plpgsql (for 8.4)  (Heikki Linnakangas <heikki@enterprisedb.com>)
Список pgsql-patches
2007/10/23, Heikki Linnakangas <heikki@enterprisedb.com>:
> Pavel Stehule wrote:
> >> This doesn't work:
> >>
> >> create function exc_using(varchar) returns varchar
> >> as $$
> >>  declare v varchar;
> >> begin
> >>   execute 'select upper($1)' into v using ('aa');
> >
> > it cannot work. Your parameter is row.
>
> Really? "execute 'select upper($1)' into v using ('aa'::varchar);"
> works, as does "execute 'select $1 + 1' into v using (12345);".
>
No, propably not. I am not sure, when Postgres grouping fields into
row. Problem is only in unknown literal.

> > But into v using 'aaa' doesn't work too :(
> >
> > ERROR:  failed to find conversion function from unknown to text
> > CONTEXT:  SQL statement "select upper($1)"
> >
> > you have to specify type: use argument, variable or casting
> > .... using text 'aaa'; or select upper($1::text)
> >
> > It is question for Tom. Why prepared statement cannot cast from literal to text
> > http://www.nabble.com/Blowback-from-text-conversion-changes-t3977711.html
>
> Yeah, I suppose we'll just live with that. Using literals as arguments
> is kind of pointless anyway, since you could as well put the literal in
> the query as well and not bother with the USING.
>
> >> I also noted that the patch makes USING a keyword. Not sure if we care
> >> about that or not.
> >>
> > I am afraid to change well know syntax (SQL/PSM use it in same context too).
>
> No I think the syntax is fine. I'm just wondering if it really has to be
> a reserved keyword to implement that syntax. Looking at the plpgsql
> grammar close, we don't categorize keywords like we do in the main
> grammar, so maybe what I'm saying doesn't make any sense.
>

yes, it's ok.

> --
>   Heikki Linnakangas
>   EnterpriseDB   http://www.enterprisedb.com
>

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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: vacuum as flags in PGPROC
Следующее
От: Tom Lane
Дата:
Сообщение: Re: vacuum as flags in PGPROC