Обсуждение: EXECUTE and FOUND

Поиск
Список
Период
Сортировка

EXECUTE and FOUND

От
Bogdan Gusiev
Дата:
I am not sure if EXECUTE 'SELECT * FROM table" correctly sets FOUND
variable.

EXECUTE 'SELECT * FROM ' || quote_ident(stmt.tablename) || ' limit 1';
if found then
  ....
end if;

Is there other way to check if EXECUTE 'SELECT ...' found something or
not?

Re: EXECUTE and FOUND

От
Pavel Stehule
Дата:
2010/5/25 Bogdan Gusiev <agresso@gmail.com>:
> I am not sure if EXECUTE 'SELECT * FROM table" correctly sets FOUND
> variable.
>

no - it doesn't it

> EXECUTE 'SELECT * FROM ' || quote_ident(stmt.tablename) || ' limit 1';
> if found then
>  ....
> end if;
>
> Is there other way to check if EXECUTE 'SELECT ...' found something or
> not?
>

yes - see on GET DIAGNOSTICS statement in plpgsql docs

regards

Pavel Stehule

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