Re: Is this the wrong list?

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Andreas Tille <tillea(at)rki(dot)de>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Is this the wrong list?
Date: 2000-08-16 16:25:42
Message-ID: Pine.BSF.4.10.10008160921550.92055-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql


On Wed, 16 Aug 2000, Andreas Tille wrote:

> On Mon, 14 Aug 2000, I wrote under the subject "Any SQL-functions examples
> available":
>
> > I tried to write my first SQL-functions with the intention to
> > port some stored procedures from MS SQL server. It would make my
> > task much simpler if someone could point me to some simple
> > examples which demonstate the use of function parameters in
> > SELECT/INSERT statements and how to get the results transformed
> > into reasonable return types, for instance if SELECT was successful
> > return true else false, etc.
> Is there any other list where I could expect answers to those simple
> questions. I could not imagine that nobody has ever written some
> simple tests with SQL functions. Perhaps this problem is to simple
> here.
>
> Or may be I have the wrong philosophy and those functions are not
> ment to be used in PostgreSQL?

I think the thing is that most people don't have basic examples, they
have whatever things they particularly needed. However, there
are a couple defined in the create_function_2 regression test.

CREATE FUNCTION hobbies(person)
RETURNS setof hobbies_r
AS 'select * from hobbies_r where person = $1.name'
LANGUAGE 'sql';
CREATE FUNCTION hobby_construct(text, text)
RETURNS hobbies_r
AS 'select $1 as name, $2 as hobby'
LANGUAGE 'sql';
CREATE FUNCTION equipment(hobbies_r)
RETURNS setof equipment_r
AS 'select * from equipment_r where hobby = $1.name'
LANGUAGE 'sql';
CREATE FUNCTION user_relns()
RETURNS setof name
AS 'select relname
from pg_class
where relname !~ ''pg_.*'' and
relkind <> ''i'' '
LANGUAGE 'sql';

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2000-08-16 16:28:53 Re: Fwd: regression test failure on initdb
Previous Message Stephan Szabo 2000-08-16 16:19:37 Re: Putting PGSQL on several disks

Browse pgsql-sql by date

  From Date Subject
Next Message Oliver Seidel 2000-08-16 21:26:06 car mileage summation / sledgehammer method
Previous Message Richard E Nairn 2000-08-16 16:16:55 Trigger vs rule