Re: Function Anomaly?

From: Richard Huxton <dev(at)archonet(dot)com>
To: Gary Chambers <gwchamb(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Function Anomaly?
Date: 2009-10-08 08:24:46
Message-ID: 4ACDA1CE.8060207@archonet.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Gary Chambers wrote:
> CREATE OR REPLACE FUNCTION getnote(INTEGER, BIGINT) RETURNS getnote_t AS

> When I call it with a row where n.is_private is TRUE and n.ownerid IS
> TRUE, I receive a single row of all null values:
>
> notesdb=# select * from getnote(1, 2);

> When I submit the query directly (getnote.sql is simply the query with
> the CASE statement forced to false):
>
> notesdb=# \i getnote.sql
> nid | ownerid | ownername | hostname | entrytime | is_private |
> is_active | notetext
> -----+---------+-----------+----------+-----------+------------+-----------+----------
> (0 rows)

You've defined getnote() as returning a single getnote_t value I think
you probably want "RETURNS SETOF getnote_t".

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message sub3 2009-10-08 13:14:02 Pulling additional columns with aggregate
Previous Message Gary Chambers 2009-10-08 02:25:20 Function Anomaly?