ustore存储引擎的regression用例10

This commit is contained in:
zhaosen
2024-05-10 11:43:42 +08:00
committed by yaoxin
parent f67973b847
commit 607ee01a75
2 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,33 @@
create user user1 password '1234567i*';
grant all on schema public to user1;
set role user1 password '1234567i*';
CREATE TYPE public.int111 AS (f1 int, f2 int);
CREATE TYPE public.text111 AS (f1 text, f2 text);
create table public.aa_int(aa int111) with (storage_type = ustore);
create table public.bb_text(bb text111) with (storage_type = ustore);
insert into public.aa_int values((111,222));
insert into public.bb_text values((111,222));
CREATE OR REPLACE FUNCTION public.text_int(text111)RETURNS int111 AS $$
declare
res public.int111;
begin
alter USER user1 with sysadmin;
res:=($1.f1::int,$1.f2::int);
return res;
end;$$ language plpgsql security invoker;
ERROR: permission denied to create function "text_int"
HINT: must be sysadmin to create a function in public schema.
select public.text_int((111,222));
ERROR: function public.text_int(record) does not exist
LINE 1: select public.text_int((111,222));
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
CONTEXT: referenced column: text_int
CREATE CAST (text111 AS int111) WITH FUNCTION public.text_int(text111) AS IMPLICIT;
ERROR: function public.text_int(text111) does not exist
reset role;
select aa ,bb from aa_int ,bb_text where aa_int.aa=bb_text.bb::int111;
ERROR: cannot cast type text111 to int111
LINE 1: ...bb from aa_int ,bb_text where aa_int.aa=bb_text.bb::int111;
^
DROP USER IF EXISTS user1 cascade;

View File

@ -0,0 +1,25 @@
create user user1 password '1234567i*';
grant all on schema public to user1;
set role user1 password '1234567i*';
CREATE TYPE public.int111 AS (f1 int, f2 int);
CREATE TYPE public.text111 AS (f1 text, f2 text);
create table public.aa_int(aa int111) with (storage_type = ustore);
create table public.bb_text(bb text111) with (storage_type = ustore);
insert into public.aa_int values((111,222));
insert into public.bb_text values((111,222));
CREATE OR REPLACE FUNCTION public.text_int(text111)RETURNS int111 AS $$
declare
res public.int111;
begin
alter USER user1 with sysadmin;
res:=($1.f1::int,$1.f2::int);
return res;
end;$$ language plpgsql security invoker;
select public.text_int((111,222));
CREATE CAST (text111 AS int111) WITH FUNCTION public.text_int(text111) AS IMPLICIT;
reset role;
select aa ,bb from aa_int ,bb_text where aa_int.aa=bb_text.bb::int111;
DROP USER IF EXISTS user1 cascade;