Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
a7b8f066
Commit
a7b8f066
authored
Feb 12, 2018
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix typo
parent
b4e2ada3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
116 additions
and
116 deletions
+116
-116
src/test/regress/expected/create_function_3.out
src/test/regress/expected/create_function_3.out
+72
-72
src/test/regress/sql/create_function_3.sql
src/test/regress/sql/create_function_3.sql
+44
-44
No files found.
src/test/regress/expected/create_function_3.out
View file @
a7b8f066
...
...
@@ -69,124 +69,124 @@ SELECT proname, provolatile FROM pg_proc
--
-- SECURITY DEFINER | INVOKER
--
CREATE FUNCTION functe
x
t_C_1(int) RETURNS bool LANGUAGE 'sql'
CREATE FUNCTION functe
s
t_C_1(int) RETURNS bool LANGUAGE 'sql'
AS 'SELECT $1 > 0';
CREATE FUNCTION functe
x
t_C_2(int) RETURNS bool LANGUAGE 'sql'
CREATE FUNCTION functe
s
t_C_2(int) RETURNS bool LANGUAGE 'sql'
SECURITY DEFINER AS 'SELECT $1 = 0';
CREATE FUNCTION functe
x
t_C_3(int) RETURNS bool LANGUAGE 'sql'
CREATE FUNCTION functe
s
t_C_3(int) RETURNS bool LANGUAGE 'sql'
SECURITY INVOKER AS 'SELECT $1 < 0';
SELECT proname, prosecdef FROM pg_proc
WHERE oid in ('functe
x
t_C_1'::regproc,
'functe
x
t_C_2'::regproc,
'functe
x
t_C_3'::regproc) ORDER BY proname;
WHERE oid in ('functe
s
t_C_1'::regproc,
'functe
s
t_C_2'::regproc,
'functe
s
t_C_3'::regproc) ORDER BY proname;
proname | prosecdef
--------------+-----------
functe
x
t_c_1 | f
functe
x
t_c_2 | t
functe
x
t_c_3 | f
functe
s
t_c_1 | f
functe
s
t_c_2 | t
functe
s
t_c_3 | f
(3 rows)
ALTER FUNCTION functe
x
t_C_1(int) IMMUTABLE; -- unrelated change, no effect
ALTER FUNCTION functe
x
t_C_2(int) SECURITY INVOKER;
ALTER FUNCTION functe
x
t_C_3(int) SECURITY DEFINER;
ALTER FUNCTION functe
s
t_C_1(int) IMMUTABLE; -- unrelated change, no effect
ALTER FUNCTION functe
s
t_C_2(int) SECURITY INVOKER;
ALTER FUNCTION functe
s
t_C_3(int) SECURITY DEFINER;
SELECT proname, prosecdef FROM pg_proc
WHERE oid in ('functe
x
t_C_1'::regproc,
'functe
x
t_C_2'::regproc,
'functe
x
t_C_3'::regproc) ORDER BY proname;
WHERE oid in ('functe
s
t_C_1'::regproc,
'functe
s
t_C_2'::regproc,
'functe
s
t_C_3'::regproc) ORDER BY proname;
proname | prosecdef
--------------+-----------
functe
x
t_c_1 | f
functe
x
t_c_2 | f
functe
x
t_c_3 | t
functe
s
t_c_1 | f
functe
s
t_c_2 | f
functe
s
t_c_3 | t
(3 rows)
--
-- LEAKPROOF
--
CREATE FUNCTION functe
x
t_E_1(int) RETURNS bool LANGUAGE 'sql'
CREATE FUNCTION functe
s
t_E_1(int) RETURNS bool LANGUAGE 'sql'
AS 'SELECT $1 > 100';
CREATE FUNCTION functe
x
t_E_2(int) RETURNS bool LANGUAGE 'sql'
CREATE FUNCTION functe
s
t_E_2(int) RETURNS bool LANGUAGE 'sql'
LEAKPROOF AS 'SELECT $1 > 100';
SELECT proname, proleakproof FROM pg_proc
WHERE oid in ('functe
x
t_E_1'::regproc,
'functe
x
t_E_2'::regproc) ORDER BY proname;
WHERE oid in ('functe
s
t_E_1'::regproc,
'functe
s
t_E_2'::regproc) ORDER BY proname;
proname | proleakproof
--------------+--------------
functe
x
t_e_1 | f
functe
x
t_e_2 | t
functe
s
t_e_1 | f
functe
s
t_e_2 | t
(2 rows)
ALTER FUNCTION functe
x
t_E_1(int) LEAKPROOF;
ALTER FUNCTION functe
x
t_E_2(int) STABLE; -- unrelated change, no effect
ALTER FUNCTION functe
s
t_E_1(int) LEAKPROOF;
ALTER FUNCTION functe
s
t_E_2(int) STABLE; -- unrelated change, no effect
SELECT proname, proleakproof FROM pg_proc
WHERE oid in ('functe
x
t_E_1'::regproc,
'functe
x
t_E_2'::regproc) ORDER BY proname;
WHERE oid in ('functe
s
t_E_1'::regproc,
'functe
s
t_E_2'::regproc) ORDER BY proname;
proname | proleakproof
--------------+--------------
functe
x
t_e_1 | t
functe
x
t_e_2 | t
functe
s
t_e_1 | t
functe
s
t_e_2 | t
(2 rows)
ALTER FUNCTION functe
x
t_E_2(int) NOT LEAKPROOF; -- remove leakproog attribute
ALTER FUNCTION functe
s
t_E_2(int) NOT LEAKPROOF; -- remove leakproog attribute
SELECT proname, proleakproof FROM pg_proc
WHERE oid in ('functe
x
t_E_1'::regproc,
'functe
x
t_E_2'::regproc) ORDER BY proname;
WHERE oid in ('functe
s
t_E_1'::regproc,
'functe
s
t_E_2'::regproc) ORDER BY proname;
proname | proleakproof
--------------+--------------
functe
x
t_e_1 | t
functe
x
t_e_2 | f
functe
s
t_e_1 | t
functe
s
t_e_2 | f
(2 rows)
-- it takes superuser privilege to turn on leakproof, but not for turn off
ALTER FUNCTION functe
x
t_E_1(int) OWNER TO regress_unpriv_user;
ALTER FUNCTION functe
x
t_E_2(int) OWNER TO regress_unpriv_user;
ALTER FUNCTION functe
s
t_E_1(int) OWNER TO regress_unpriv_user;
ALTER FUNCTION functe
s
t_E_2(int) OWNER TO regress_unpriv_user;
SET SESSION AUTHORIZATION regress_unpriv_user;
SET search_path TO temp_func_test, public;
ALTER FUNCTION functe
x
t_E_1(int) NOT LEAKPROOF;
ALTER FUNCTION functe
x
t_E_2(int) LEAKPROOF;
ALTER FUNCTION functe
s
t_E_1(int) NOT LEAKPROOF;
ALTER FUNCTION functe
s
t_E_2(int) LEAKPROOF;
ERROR: only superuser can define a leakproof function
CREATE FUNCTION functe
x
t_E_3(int) RETURNS bool LANGUAGE 'sql'
CREATE FUNCTION functe
s
t_E_3(int) RETURNS bool LANGUAGE 'sql'
LEAKPROOF AS 'SELECT $1 < 200'; -- failed
ERROR: only superuser can define a leakproof function
RESET SESSION AUTHORIZATION;
--
-- CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT
--
CREATE FUNCTION functe
x
t_F_1(int) RETURNS bool LANGUAGE 'sql'
CREATE FUNCTION functe
s
t_F_1(int) RETURNS bool LANGUAGE 'sql'
AS 'SELECT $1 > 50';
CREATE FUNCTION functe
x
t_F_2(int) RETURNS bool LANGUAGE 'sql'
CREATE FUNCTION functe
s
t_F_2(int) RETURNS bool LANGUAGE 'sql'
CALLED ON NULL INPUT AS 'SELECT $1 = 50';
CREATE FUNCTION functe
x
t_F_3(int) RETURNS bool LANGUAGE 'sql'
CREATE FUNCTION functe
s
t_F_3(int) RETURNS bool LANGUAGE 'sql'
RETURNS NULL ON NULL INPUT AS 'SELECT $1 < 50';
CREATE FUNCTION functe
x
t_F_4(int) RETURNS bool LANGUAGE 'sql'
CREATE FUNCTION functe
s
t_F_4(int) RETURNS bool LANGUAGE 'sql'
STRICT AS 'SELECT $1 = 50';
SELECT proname, proisstrict FROM pg_proc
WHERE oid in ('functe
x
t_F_1'::regproc,
'functe
x
t_F_2'::regproc,
'functe
x
t_F_3'::regproc,
'functe
x
t_F_4'::regproc) ORDER BY proname;
WHERE oid in ('functe
s
t_F_1'::regproc,
'functe
s
t_F_2'::regproc,
'functe
s
t_F_3'::regproc,
'functe
s
t_F_4'::regproc) ORDER BY proname;
proname | proisstrict
--------------+-------------
functe
x
t_f_1 | f
functe
x
t_f_2 | f
functe
x
t_f_3 | t
functe
x
t_f_4 | t
functe
s
t_f_1 | f
functe
s
t_f_2 | f
functe
s
t_f_3 | t
functe
s
t_f_4 | t
(4 rows)
ALTER FUNCTION functe
x
t_F_1(int) IMMUTABLE; -- unrelated change, no effect
ALTER FUNCTION functe
x
t_F_2(int) STRICT;
ALTER FUNCTION functe
x
t_F_3(int) CALLED ON NULL INPUT;
ALTER FUNCTION functe
s
t_F_1(int) IMMUTABLE; -- unrelated change, no effect
ALTER FUNCTION functe
s
t_F_2(int) STRICT;
ALTER FUNCTION functe
s
t_F_3(int) CALLED ON NULL INPUT;
SELECT proname, proisstrict FROM pg_proc
WHERE oid in ('functe
x
t_F_1'::regproc,
'functe
x
t_F_2'::regproc,
'functe
x
t_F_3'::regproc,
'functe
x
t_F_4'::regproc) ORDER BY proname;
WHERE oid in ('functe
s
t_F_1'::regproc,
'functe
s
t_F_2'::regproc,
'functe
s
t_F_3'::regproc,
'functe
s
t_F_4'::regproc) ORDER BY proname;
proname | proisstrict
--------------+-------------
functe
x
t_f_1 | f
functe
x
t_f_2 | t
functe
x
t_f_3 | f
functe
x
t_f_4 | t
functe
s
t_f_1 | f
functe
s
t_f_2 | t
functe
s
t_f_3 | f
functe
s
t_f_4 | t
(4 rows)
-- information_schema tests
...
...
@@ -236,15 +236,15 @@ drop cascades to function functest_a_3()
drop cascades to function functest_b_2(integer)
drop cascades to function functest_b_3(integer)
drop cascades to function functest_b_4(integer)
drop cascades to function functe
x
t_c_1(integer)
drop cascades to function functe
x
t_c_2(integer)
drop cascades to function functe
x
t_c_3(integer)
drop cascades to function functe
x
t_e_1(integer)
drop cascades to function functe
x
t_e_2(integer)
drop cascades to function functe
x
t_f_1(integer)
drop cascades to function functe
x
t_f_2(integer)
drop cascades to function functe
x
t_f_3(integer)
drop cascades to function functe
x
t_f_4(integer)
drop cascades to function functe
s
t_c_1(integer)
drop cascades to function functe
s
t_c_2(integer)
drop cascades to function functe
s
t_c_3(integer)
drop cascades to function functe
s
t_e_1(integer)
drop cascades to function functe
s
t_e_2(integer)
drop cascades to function functe
s
t_f_1(integer)
drop cascades to function functe
s
t_f_2(integer)
drop cascades to function functe
s
t_f_3(integer)
drop cascades to function functe
s
t_f_4(integer)
drop cascades to function functest_b_2(bigint)
DROP USER regress_unpriv_user;
RESET search_path;
src/test/regress/sql/create_function_3.sql
View file @
a7b8f066
...
...
@@ -52,57 +52,57 @@ SELECT proname, provolatile FROM pg_proc
--
-- SECURITY DEFINER | INVOKER
--
CREATE
FUNCTION
functe
x
t_C_1
(
int
)
RETURNS
bool
LANGUAGE
'sql'
CREATE
FUNCTION
functe
s
t_C_1
(
int
)
RETURNS
bool
LANGUAGE
'sql'
AS
'SELECT $1 > 0'
;
CREATE
FUNCTION
functe
x
t_C_2
(
int
)
RETURNS
bool
LANGUAGE
'sql'
CREATE
FUNCTION
functe
s
t_C_2
(
int
)
RETURNS
bool
LANGUAGE
'sql'
SECURITY
DEFINER
AS
'SELECT $1 = 0'
;
CREATE
FUNCTION
functe
x
t_C_3
(
int
)
RETURNS
bool
LANGUAGE
'sql'
CREATE
FUNCTION
functe
s
t_C_3
(
int
)
RETURNS
bool
LANGUAGE
'sql'
SECURITY
INVOKER
AS
'SELECT $1 < 0'
;
SELECT
proname
,
prosecdef
FROM
pg_proc
WHERE
oid
in
(
'functe
x
t_C_1'
::
regproc
,
'functe
x
t_C_2'
::
regproc
,
'functe
x
t_C_3'
::
regproc
)
ORDER
BY
proname
;
WHERE
oid
in
(
'functe
s
t_C_1'
::
regproc
,
'functe
s
t_C_2'
::
regproc
,
'functe
s
t_C_3'
::
regproc
)
ORDER
BY
proname
;
ALTER
FUNCTION
functe
x
t_C_1
(
int
)
IMMUTABLE
;
-- unrelated change, no effect
ALTER
FUNCTION
functe
x
t_C_2
(
int
)
SECURITY
INVOKER
;
ALTER
FUNCTION
functe
x
t_C_3
(
int
)
SECURITY
DEFINER
;
ALTER
FUNCTION
functe
s
t_C_1
(
int
)
IMMUTABLE
;
-- unrelated change, no effect
ALTER
FUNCTION
functe
s
t_C_2
(
int
)
SECURITY
INVOKER
;
ALTER
FUNCTION
functe
s
t_C_3
(
int
)
SECURITY
DEFINER
;
SELECT
proname
,
prosecdef
FROM
pg_proc
WHERE
oid
in
(
'functe
x
t_C_1'
::
regproc
,
'functe
x
t_C_2'
::
regproc
,
'functe
x
t_C_3'
::
regproc
)
ORDER
BY
proname
;
WHERE
oid
in
(
'functe
s
t_C_1'
::
regproc
,
'functe
s
t_C_2'
::
regproc
,
'functe
s
t_C_3'
::
regproc
)
ORDER
BY
proname
;
--
-- LEAKPROOF
--
CREATE
FUNCTION
functe
x
t_E_1
(
int
)
RETURNS
bool
LANGUAGE
'sql'
CREATE
FUNCTION
functe
s
t_E_1
(
int
)
RETURNS
bool
LANGUAGE
'sql'
AS
'SELECT $1 > 100'
;
CREATE
FUNCTION
functe
x
t_E_2
(
int
)
RETURNS
bool
LANGUAGE
'sql'
CREATE
FUNCTION
functe
s
t_E_2
(
int
)
RETURNS
bool
LANGUAGE
'sql'
LEAKPROOF
AS
'SELECT $1 > 100'
;
SELECT
proname
,
proleakproof
FROM
pg_proc
WHERE
oid
in
(
'functe
x
t_E_1'
::
regproc
,
'functe
x
t_E_2'
::
regproc
)
ORDER
BY
proname
;
WHERE
oid
in
(
'functe
s
t_E_1'
::
regproc
,
'functe
s
t_E_2'
::
regproc
)
ORDER
BY
proname
;
ALTER
FUNCTION
functe
x
t_E_1
(
int
)
LEAKPROOF
;
ALTER
FUNCTION
functe
x
t_E_2
(
int
)
STABLE
;
-- unrelated change, no effect
ALTER
FUNCTION
functe
s
t_E_1
(
int
)
LEAKPROOF
;
ALTER
FUNCTION
functe
s
t_E_2
(
int
)
STABLE
;
-- unrelated change, no effect
SELECT
proname
,
proleakproof
FROM
pg_proc
WHERE
oid
in
(
'functe
x
t_E_1'
::
regproc
,
'functe
x
t_E_2'
::
regproc
)
ORDER
BY
proname
;
WHERE
oid
in
(
'functe
s
t_E_1'
::
regproc
,
'functe
s
t_E_2'
::
regproc
)
ORDER
BY
proname
;
ALTER
FUNCTION
functe
x
t_E_2
(
int
)
NOT
LEAKPROOF
;
-- remove leakproog attribute
ALTER
FUNCTION
functe
s
t_E_2
(
int
)
NOT
LEAKPROOF
;
-- remove leakproog attribute
SELECT
proname
,
proleakproof
FROM
pg_proc
WHERE
oid
in
(
'functe
x
t_E_1'
::
regproc
,
'functe
x
t_E_2'
::
regproc
)
ORDER
BY
proname
;
WHERE
oid
in
(
'functe
s
t_E_1'
::
regproc
,
'functe
s
t_E_2'
::
regproc
)
ORDER
BY
proname
;
-- it takes superuser privilege to turn on leakproof, but not for turn off
ALTER
FUNCTION
functe
x
t_E_1
(
int
)
OWNER
TO
regress_unpriv_user
;
ALTER
FUNCTION
functe
x
t_E_2
(
int
)
OWNER
TO
regress_unpriv_user
;
ALTER
FUNCTION
functe
s
t_E_1
(
int
)
OWNER
TO
regress_unpriv_user
;
ALTER
FUNCTION
functe
s
t_E_2
(
int
)
OWNER
TO
regress_unpriv_user
;
SET
SESSION
AUTHORIZATION
regress_unpriv_user
;
SET
search_path
TO
temp_func_test
,
public
;
ALTER
FUNCTION
functe
x
t_E_1
(
int
)
NOT
LEAKPROOF
;
ALTER
FUNCTION
functe
x
t_E_2
(
int
)
LEAKPROOF
;
ALTER
FUNCTION
functe
s
t_E_1
(
int
)
NOT
LEAKPROOF
;
ALTER
FUNCTION
functe
s
t_E_2
(
int
)
LEAKPROOF
;
CREATE
FUNCTION
functe
x
t_E_3
(
int
)
RETURNS
bool
LANGUAGE
'sql'
CREATE
FUNCTION
functe
s
t_E_3
(
int
)
RETURNS
bool
LANGUAGE
'sql'
LEAKPROOF
AS
'SELECT $1 < 200'
;
-- failed
RESET
SESSION
AUTHORIZATION
;
...
...
@@ -110,28 +110,28 @@ RESET SESSION AUTHORIZATION;
--
-- CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT
--
CREATE
FUNCTION
functe
x
t_F_1
(
int
)
RETURNS
bool
LANGUAGE
'sql'
CREATE
FUNCTION
functe
s
t_F_1
(
int
)
RETURNS
bool
LANGUAGE
'sql'
AS
'SELECT $1 > 50'
;
CREATE
FUNCTION
functe
x
t_F_2
(
int
)
RETURNS
bool
LANGUAGE
'sql'
CREATE
FUNCTION
functe
s
t_F_2
(
int
)
RETURNS
bool
LANGUAGE
'sql'
CALLED
ON
NULL
INPUT
AS
'SELECT $1 = 50'
;
CREATE
FUNCTION
functe
x
t_F_3
(
int
)
RETURNS
bool
LANGUAGE
'sql'
CREATE
FUNCTION
functe
s
t_F_3
(
int
)
RETURNS
bool
LANGUAGE
'sql'
RETURNS
NULL
ON
NULL
INPUT
AS
'SELECT $1 < 50'
;
CREATE
FUNCTION
functe
x
t_F_4
(
int
)
RETURNS
bool
LANGUAGE
'sql'
CREATE
FUNCTION
functe
s
t_F_4
(
int
)
RETURNS
bool
LANGUAGE
'sql'
STRICT
AS
'SELECT $1 = 50'
;
SELECT
proname
,
proisstrict
FROM
pg_proc
WHERE
oid
in
(
'functe
x
t_F_1'
::
regproc
,
'functe
x
t_F_2'
::
regproc
,
'functe
x
t_F_3'
::
regproc
,
'functe
x
t_F_4'
::
regproc
)
ORDER
BY
proname
;
ALTER
FUNCTION
functe
x
t_F_1
(
int
)
IMMUTABLE
;
-- unrelated change, no effect
ALTER
FUNCTION
functe
x
t_F_2
(
int
)
STRICT
;
ALTER
FUNCTION
functe
x
t_F_3
(
int
)
CALLED
ON
NULL
INPUT
;
WHERE
oid
in
(
'functe
s
t_F_1'
::
regproc
,
'functe
s
t_F_2'
::
regproc
,
'functe
s
t_F_3'
::
regproc
,
'functe
s
t_F_4'
::
regproc
)
ORDER
BY
proname
;
ALTER
FUNCTION
functe
s
t_F_1
(
int
)
IMMUTABLE
;
-- unrelated change, no effect
ALTER
FUNCTION
functe
s
t_F_2
(
int
)
STRICT
;
ALTER
FUNCTION
functe
s
t_F_3
(
int
)
CALLED
ON
NULL
INPUT
;
SELECT
proname
,
proisstrict
FROM
pg_proc
WHERE
oid
in
(
'functe
x
t_F_1'
::
regproc
,
'functe
x
t_F_2'
::
regproc
,
'functe
x
t_F_3'
::
regproc
,
'functe
x
t_F_4'
::
regproc
)
ORDER
BY
proname
;
WHERE
oid
in
(
'functe
s
t_F_1'
::
regproc
,
'functe
s
t_F_2'
::
regproc
,
'functe
s
t_F_3'
::
regproc
,
'functe
s
t_F_4'
::
regproc
)
ORDER
BY
proname
;
-- information_schema tests
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment