contrib/tablefunc fixes (GRANTs to PUBLIC, use CREATE TYPE vice CREATE VIEW) - Mailing list pgsql-patches

From Joe Conway
Subject contrib/tablefunc fixes (GRANTs to PUBLIC, use CREATE TYPE vice CREATE VIEW)
Date
Msg-id 3D8222B0.5020108@joeconway.com
Whole thread Raw
Responses Re: contrib/tablefunc fixes (GRANTs to PUBLIC, use CREATE TYPE vice CREATE VIEW)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
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.

Please apply.

Thanks,

Joe
Index: contrib/tablefunc/tablefunc.sql.in
===================================================================
RCS file: /opt/src/cvs/pgsql-server/contrib/tablefunc/tablefunc.sql.in,v
retrieving revision 1.3
diff -c -r1.3 tablefunc.sql.in
*** contrib/tablefunc/tablefunc.sql.in    2 Sep 2002 05:44:05 -0000    1.3
--- contrib/tablefunc/tablefunc.sql.in    13 Sep 2002 17:22:54 -0000
***************
*** 2,27 ****
    RETURNS setof float8
    AS 'MODULE_PATHNAME','normal_rand' LANGUAGE 'c' VOLATILE STRICT;

! CREATE VIEW tablefunc_crosstab_2 AS
!   SELECT
!     ''::TEXT AS row_name,
!     ''::TEXT AS category_1,
!     ''::TEXT AS category_2;
!
! CREATE VIEW tablefunc_crosstab_3 AS
!   SELECT
!     ''::TEXT AS row_name,
!     ''::TEXT AS category_1,
!     ''::TEXT AS category_2,
!     ''::TEXT AS category_3;
!
! CREATE VIEW tablefunc_crosstab_4 AS
!   SELECT
!     ''::TEXT AS row_name,
!     ''::TEXT AS category_1,
!     ''::TEXT AS category_2,
!     ''::TEXT AS category_3,
!     ''::TEXT AS category_4;

  CREATE OR REPLACE FUNCTION crosstab2(text)
    RETURNS setof tablefunc_crosstab_2
--- 2,30 ----
    RETURNS setof float8
    AS 'MODULE_PATHNAME','normal_rand' LANGUAGE 'c' VOLATILE STRICT;

! CREATE TYPE tablefunc_crosstab_2 AS
! (
!   row_name TEXT,
!   category_1 TEXT,
!   category_2 TEXT
! );
!
! CREATE TYPE tablefunc_crosstab_3 AS
! (
!   row_name TEXT,
!   category_1 TEXT,
!   category_2 TEXT,
!   category_3 TEXT
! );
!
! CREATE TYPE tablefunc_crosstab_4 AS
! (
!   row_name TEXT,
!   category_1 TEXT,
!   category_2 TEXT,
!   category_3 TEXT,
!   category_4 TEXT
! );

  CREATE OR REPLACE FUNCTION crosstab2(text)
    RETURNS setof tablefunc_crosstab_2
***************
*** 46,48 ****
--- 49,59 ----
  CREATE OR REPLACE FUNCTION connectby(text,text,text,text,int)
    RETURNS setof record
    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;
Index: contrib/tablefunc/expected/tablefunc.out
===================================================================
RCS file: /opt/src/cvs/pgsql-server/contrib/tablefunc/expected/tablefunc.out,v
retrieving revision 1.1
diff -c -r1.1 tablefunc.out
*** contrib/tablefunc/expected/tablefunc.out    12 Sep 2002 00:14:40 -0000    1.1
--- contrib/tablefunc/expected/tablefunc.out    13 Sep 2002 17:24:30 -0000
***************
*** 1,6 ****
  --
  -- first, define the functions.  Turn off echoing so that expected file
! -- does not depend on contents of seg.sql.
  --
  \set ECHO none
  --
--- 1,6 ----
  --
  -- first, define the functions.  Turn off echoing so that expected file
! -- does not depend on contents of tablefunc.sql.
  --
  \set ECHO none
  --
Index: contrib/tablefunc/sql/tablefunc.sql
===================================================================
RCS file: /opt/src/cvs/pgsql-server/contrib/tablefunc/sql/tablefunc.sql,v
retrieving revision 1.1
diff -c -r1.1 tablefunc.sql
*** contrib/tablefunc/sql/tablefunc.sql    12 Sep 2002 00:14:40 -0000    1.1
--- contrib/tablefunc/sql/tablefunc.sql    13 Sep 2002 17:24:18 -0000
***************
*** 1,6 ****
  --
  -- first, define the functions.  Turn off echoing so that expected file
! -- does not depend on contents of seg.sql.
  --
  \set ECHO none
  \i tablefunc.sql
--- 1,6 ----
  --
  -- first, define the functions.  Turn off echoing so that expected file
! -- does not depend on contents of tablefunc.sql.
  --
  \set ECHO none
  \i tablefunc.sql

pgsql-patches by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: [HACKERS] DROP COLUMN misbehaviour with multiple inheritance
Next
From: Joe Conway
Date:
Subject: contrib/fuzzystringmatch GRANTs