Why can't I have a "language sql" anonymous block?

Поиск
Список
Период
Сортировка
От Bryn Llewellyn
Тема Why can't I have a "language sql" anonymous block?
Дата
Msg-id C9838A29-8C84-4F68-9C41-5CB4665911E5@yugabyte.com
обсуждение исходный текст
Ответы Re: Why can't I have a "language sql" anonymous block?
Список pgsql-general
My question is this:

Was there a deliberate decision not to allow a “language sql” anonymous block? Or is it just that nobody thought that it would be useful?

Here’s what I mean. First, something that works (using PG Version 14.1):

create procedure p_plpgsql()
  security definer
  language plpgsql
as $body$
begin
  drop table if exists t cascade;
  create table t(k serial primary key, v text not null);
end;
$body$;

I can transform this trivially to an anonymous block:

do language plpgsql $body$
begin
  drop table if exists t cascade;
  create table t(k serial primary key, v text not null);
end;
$body$;

I can also transform the procedure trivially to "language sql”:

create procedure p_sql()
  security definer
  language sql
as $body$
  drop table if exists t cascade;
  create table t(k serial primary key, v text not null);
$body$;

But trying the corresponding “language sql” anonymous block:

do language sql $body$
begin
  drop table if exists t cascade;
  create table t(k serial primary key, v text not null);
end;
$body$;

Causes this error:

0A000 (feature_not_supported): language "sql" does not support inline code execution


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

Предыдущее
От: Jean Baro
Дата:
Сообщение: Re: Where can I follow the progress of "Pluggable Storage" development?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Why can't I have a "language sql" anonymous block?