pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chris Lukenbill <chris@blendinteractive.com>
To: Michael Fuhr <mike@fuhr.org>
Cc: pgsql-sql@postgresql.org
Subject: Re: return setof records
Date: Fri, 28 Jul 2006 13:01:30 -0500
Message-ID: <fdb4b04c0607281101s5b48dce0v69cc381c23f04343@mail.gmail.com> (raw)
In-Reply-To: <20060728141348.GA95234@winnie.fuhr.org>
References: <1154032891.v2.fusewebmail-168507@ffuse18>
	<20060728141348.GA95234@winnie.fuhr.org>

I think that actually solved the problem. The fact that I was sending back a
bigint.  One of those things that's hard to spot when I don't know if I was
on the right track to begin with.  Thank you everyone for your help.

Chris

On 7/28/06, Michael Fuhr <mike@fuhr.org> wrote:
>
> On Thu, Jul 27, 2006 at 03:41:31PM -0500, Chris Lukenbill wrote:
> > Everywhere I've looked the agreement was that making a call to the
> > function had to be done as follows:
> >
> > SELECT * FROM sp_frontalerts_summary(1,'2006-07-27 18:08:09','2006-07-27
> > 19:58:15' ) as (numitems int, region int);
>
> That's one way.  Another way would be for the function to use OUT
> parameters (if you're running 8.1) or to return a custom type so
> you could omit the column definition list.  Then the query would be:
>
> SELECT *
> FROM sp_frontalerts_summary(1, '2006-07-27 18:08:09', '2006-07-27
> 19:58:15');
>
> > So there isn't a question on that.  My question is, how do I return a
> > "setof record" back to the application.
>
> The function and how you're calling it look correct except that
> count() returns bigint, not int.  You didn't mention what error
> you're getting but I'd guess it's "wrong record type supplied in
> RETURN NEXT".  Try using "numitems bigint" instead of "numitems int".
>
> --
> Michael Fuhr
>
>

view thread (3+ messages)

Message-ID: <fdb4b04c0607281101s5b48dce0v69cc381c23f04343@mail.gmail.com>
Permalink:  ../fdb4b04c0607281101s5b48dce0v69cc381c23f04343@mail.gmail.com/
Also on:    postgresql.org/message-id/fdb4b04c0607281101s5b48dce0v69cc381c23f04343@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: chris@blendinteractive.com, mike@fuhr.org
  Subject: Re: return setof records
  In-Reply-To: <fdb4b04c0607281101s5b48dce0v69cc381c23f04343@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox