Re: anonymous composite types for Table Functions (aka

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org
Subject: Re: anonymous composite types for Table Functions (aka
Date: 2002-08-05 16:25:35
Message-ID: 200208051625.g75GPZw00226@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches


Your patch has been added to the PostgreSQL unapplied patches list at:

http://candle.pha.pa.us/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------

Joe Conway wrote:
> Joe Conway wrote:
> > Simple change -- patch attached.
>
> Of course, the simple change has ripple effects! Here's a patch for the
> rangefunc regression test for the new behavior.
>
> Joe

> Index: src/test/regress/expected/rangefuncs.out
> ===================================================================
> RCS file: /opt/src/cvs/pgsql-server/src/test/regress/expected/rangefuncs.out,v
> retrieving revision 1.2
> diff -c -r1.2 rangefuncs.out
> *** src/test/regress/expected/rangefuncs.out 16 Jul 2002 05:53:34 -0000 1.2
> --- src/test/regress/expected/rangefuncs.out 5 Aug 2002 05:52:01 -0000
> ***************
> *** 48,56 ****
> -- sql, proretset = f, prorettype = b
> CREATE FUNCTION getfoo(int) RETURNS int AS 'SELECT $1;' LANGUAGE SQL;
> SELECT * FROM getfoo(1) AS t1;
> ! getfoo
> ! --------
> ! 1
> (1 row)
>
> CREATE VIEW vw_getfoo AS SELECT * FROM getfoo(1);
> --- 48,56 ----
> -- sql, proretset = f, prorettype = b
> CREATE FUNCTION getfoo(int) RETURNS int AS 'SELECT $1;' LANGUAGE SQL;
> SELECT * FROM getfoo(1) AS t1;
> ! t1
> ! ----
> ! 1
> (1 row)
>
> CREATE VIEW vw_getfoo AS SELECT * FROM getfoo(1);
> ***************
> *** 65,74 ****
> DROP FUNCTION getfoo(int);
> CREATE FUNCTION getfoo(int) RETURNS setof int AS 'SELECT fooid FROM foo WHERE fooid = $1;' LANGUAGE SQL;
> SELECT * FROM getfoo(1) AS t1;
> ! getfoo
> ! --------
> ! 1
> ! 1
> (2 rows)
>
> CREATE VIEW vw_getfoo AS SELECT * FROM getfoo(1);
> --- 65,74 ----
> DROP FUNCTION getfoo(int);
> CREATE FUNCTION getfoo(int) RETURNS setof int AS 'SELECT fooid FROM foo WHERE fooid = $1;' LANGUAGE SQL;
> SELECT * FROM getfoo(1) AS t1;
> ! t1
> ! ----
> ! 1
> ! 1
> (2 rows)
>
> CREATE VIEW vw_getfoo AS SELECT * FROM getfoo(1);
> ***************
> *** 84,91 ****
> DROP FUNCTION getfoo(int);
> CREATE FUNCTION getfoo(int) RETURNS setof text AS 'SELECT fooname FROM foo WHERE fooid = $1;' LANGUAGE SQL;
> SELECT * FROM getfoo(1) AS t1;
> ! getfoo
> ! --------
> Joe
> Ed
> (2 rows)
> --- 84,91 ----
> DROP FUNCTION getfoo(int);
> CREATE FUNCTION getfoo(int) RETURNS setof text AS 'SELECT fooname FROM foo WHERE fooid = $1;' LANGUAGE SQL;
> SELECT * FROM getfoo(1) AS t1;
> ! t1
> ! -----
> Joe
> Ed
> (2 rows)
> ***************
> *** 139,147 ****
> DROP FUNCTION getfoo(int);
> CREATE FUNCTION getfoo(int) RETURNS int AS 'DECLARE fooint int; BEGIN SELECT fooid into fooint FROM foo WHERE fooid = $1; RETURN fooint; END;' LANGUAGE 'plpgsql';
> SELECT * FROM getfoo(1) AS t1;
> ! getfoo
> ! --------
> ! 1
> (1 row)
>
> CREATE VIEW vw_getfoo AS SELECT * FROM getfoo(1);
> --- 139,147 ----
> DROP FUNCTION getfoo(int);
> CREATE FUNCTION getfoo(int) RETURNS int AS 'DECLARE fooint int; BEGIN SELECT fooid into fooint FROM foo WHERE fooid = $1; RETURN fooint; END;' LANGUAGE 'plpgsql';
> SELECT * FROM getfoo(1) AS t1;
> ! t1
> ! ----
> ! 1
> (1 row)
>
> CREATE VIEW vw_getfoo AS SELECT * FROM getfoo(1);

>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-08-05 16:25:37 Re: FUNC_MAX_ARGS benchmarks
Previous Message Bruce Momjian 2002-08-05 16:25:18 Re: anonymous composite types for Table Functions (aka

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2002-08-05 16:28:03 Re: anonymous composite types for Table Functions (aka
Previous Message Bruce Momjian 2002-08-05 16:25:18 Re: anonymous composite types for Table Functions (aka