From: | Bryn Llewellyn <bryn(at)yugabyte(dot)com> |
---|---|
To: | pgsql-general list <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Why can't I have a "language sql" anonymous block? |
Date: | 2021-12-13 20:45:48 |
Message-ID: | C9838A29-8C84-4F68-9C41-5CB4665911E5@yugabyte.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2021-12-13 20:53:37 | Re: Why can't I have a "language sql" anonymous block? |
Previous Message | Jean Baro | 2021-12-13 19:37:36 | Re: Where can I follow the progress of "Pluggable Storage" development? |