Re: Function Anomaly? - Mailing list pgsql-sql

From Richard Huxton
Subject Re: Function Anomaly?
Date
Msg-id 4ACDA1CE.8060207@archonet.com
Whole thread Raw
In response to Function Anomaly?  (Gary Chambers <gwchamb@gmail.com>)
List 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


pgsql-sql by date:

Previous
From: Gary Chambers
Date:
Subject: Function Anomaly?
Next
From: sub3
Date:
Subject: Pulling additional columns with aggregate