ustore存储引擎的regression用例10
This commit is contained in:
33
src/test/regress/expected/cast_privileges_test_ustore.out
Normal file
33
src/test/regress/expected/cast_privileges_test_ustore.out
Normal 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;
|
||||
25
src/test/regress/sql/cast_privileges_test_ustore.sql
Normal file
25
src/test/regress/sql/cast_privileges_test_ustore.sql
Normal 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;
|
||||
Reference in New Issue
Block a user