Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux