Re: SRFs returning records from a view

From: Mark Lubratt <mark(dot)lubratt(at)indeq(dot)com>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: SRFs returning records from a view
Date: 2005-06-02 16:12:27
Message-ID: d9f71326d0532093a33f46d337200006@indeq.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

AAARRRGGGHHH... Now I understand you, Josh. Sorry.

You are correct.

Thanks!
Mark

On Jun 1, 2005, at 4:39 PM, Joshua D. Drake wrote:

> mark(dot)lubratt(at)indeq(dot)com wrote:
>> Hello!
>> I have a view that I'm putting into a report in my application. I'd
>> like to get several blank lines returned by the view as well as the
>> legitimate data (to leave room in the report for manual entries). I
>> thought I could make a SRF that would return the data from the view
>> and
>> then spit out a number of blank records.
>> As a first step in getting my SRF feet wet, I tried:
>> CREATE OR REPLACE FUNCTION bluecard(int4)
>> RETURNS SETOF view_bluecard AS
>> $BODY$declare
>> r view_bluecard%rowtype;
>> begin
>> for r in select * from view_bluecard where job_id = jn loop
>> return next r;
>> end loop;
>> return;
>> end;$BODY$
>> LANGUAGE 'plpgsql' VOLATILE;
>> where view_bluecard is the view that is already defined. When I try
>> select bluecard(1130);
>
> select * from bluecard(1130)?
>
> Sincerely,
>
> Joshua D. Drake
>
>> ---------------------------(end of
>> broadcast)---------------------------
>> TIP 7: don't forget to increase your free space map settings
>
>
> --
> Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240
> PostgreSQL Replication, Consulting, Custom Programming, 24x7 support
> Managed Services, Shared and Dedicated Hosting
> Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alexandre Biancalana 2005-06-02 16:25:31 Re: postgresql 8 abort with signal 10
Previous Message Himanshu Baweja 2005-06-02 16:07:12 Re: Stats not getting updated....