mirror of https://github.com/postgres/postgres
Attached is a patch to fix some recently raised issues that exist in
contrib/tablefunc. Specifically it replaces the use of VIEWs (for needed composite type creation) with use of CREATE TYPE. It also performs GRANT EXECUTE ON FUNCTION foo() TO PUBLIC for all of the created functions. There was also a cosmetic change to two regression files. Joe Conway
This commit is contained in:
parent
f7978c6f1d
commit
bd04184b11
|
@ -1,6 +1,6 @@
|
||||||
--
|
--
|
||||||
-- first, define the functions. Turn off echoing so that expected file
|
-- first, define the functions. Turn off echoing so that expected file
|
||||||
-- does not depend on contents of seg.sql.
|
-- does not depend on contents of tablefunc.sql.
|
||||||
--
|
--
|
||||||
\set ECHO none
|
\set ECHO none
|
||||||
--
|
--
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
--
|
--
|
||||||
-- first, define the functions. Turn off echoing so that expected file
|
-- first, define the functions. Turn off echoing so that expected file
|
||||||
-- does not depend on contents of seg.sql.
|
-- does not depend on contents of tablefunc.sql.
|
||||||
--
|
--
|
||||||
\set ECHO none
|
\set ECHO none
|
||||||
\i tablefunc.sql
|
\i tablefunc.sql
|
||||||
|
|
|
@ -2,26 +2,29 @@ CREATE OR REPLACE FUNCTION normal_rand(int4, float8, float8, int4)
|
||||||
RETURNS setof float8
|
RETURNS setof float8
|
||||||
AS 'MODULE_PATHNAME','normal_rand' LANGUAGE 'c' VOLATILE STRICT;
|
AS 'MODULE_PATHNAME','normal_rand' LANGUAGE 'c' VOLATILE STRICT;
|
||||||
|
|
||||||
CREATE VIEW tablefunc_crosstab_2 AS
|
CREATE TYPE tablefunc_crosstab_2 AS
|
||||||
SELECT
|
(
|
||||||
''::TEXT AS row_name,
|
row_name TEXT,
|
||||||
''::TEXT AS category_1,
|
category_1 TEXT,
|
||||||
''::TEXT AS category_2;
|
category_2 TEXT
|
||||||
|
);
|
||||||
|
|
||||||
CREATE VIEW tablefunc_crosstab_3 AS
|
CREATE TYPE tablefunc_crosstab_3 AS
|
||||||
SELECT
|
(
|
||||||
''::TEXT AS row_name,
|
row_name TEXT,
|
||||||
''::TEXT AS category_1,
|
category_1 TEXT,
|
||||||
''::TEXT AS category_2,
|
category_2 TEXT,
|
||||||
''::TEXT AS category_3;
|
category_3 TEXT
|
||||||
|
);
|
||||||
|
|
||||||
CREATE VIEW tablefunc_crosstab_4 AS
|
CREATE TYPE tablefunc_crosstab_4 AS
|
||||||
SELECT
|
(
|
||||||
''::TEXT AS row_name,
|
row_name TEXT,
|
||||||
''::TEXT AS category_1,
|
category_1 TEXT,
|
||||||
''::TEXT AS category_2,
|
category_2 TEXT,
|
||||||
''::TEXT AS category_3,
|
category_3 TEXT,
|
||||||
''::TEXT AS category_4;
|
category_4 TEXT
|
||||||
|
);
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION crosstab2(text)
|
CREATE OR REPLACE FUNCTION crosstab2(text)
|
||||||
RETURNS setof tablefunc_crosstab_2
|
RETURNS setof tablefunc_crosstab_2
|
||||||
|
@ -46,3 +49,11 @@ CREATE OR REPLACE FUNCTION connectby(text,text,text,text,int,text)
|
||||||
CREATE OR REPLACE FUNCTION connectby(text,text,text,text,int)
|
CREATE OR REPLACE FUNCTION connectby(text,text,text,text,int)
|
||||||
RETURNS setof record
|
RETURNS setof record
|
||||||
AS 'MODULE_PATHNAME','connectby_text' LANGUAGE 'c' STABLE STRICT;
|
AS 'MODULE_PATHNAME','connectby_text' LANGUAGE 'c' STABLE STRICT;
|
||||||
|
|
||||||
|
GRANT EXECUTE ON FUNCTION normal_rand(int4, float8, float8, int4) TO PUBLIC;
|
||||||
|
GRANT EXECUTE ON FUNCTION crosstab2(text) TO PUBLIC;
|
||||||
|
GRANT EXECUTE ON FUNCTION crosstab3(text) TO PUBLIC;
|
||||||
|
GRANT EXECUTE ON FUNCTION crosstab4(text) TO PUBLIC;
|
||||||
|
GRANT EXECUTE ON FUNCTION crosstab(text,int) TO PUBLIC;
|
||||||
|
GRANT EXECUTE ON FUNCTION connectby(text,text,text,text,int,text) TO PUBLIC;
|
||||||
|
GRANT EXECUTE ON FUNCTION connectby(text,text,text,text,int) TO PUBLIC;
|
||||||
|
|
Loading…
Reference in New Issue