pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Gary Chambers <gwchamb@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Function Anomaly?
Date: Thu, 08 Oct 2009 09:24:46 +0100
Message-ID: <4ACDA1CE.8060207@archonet.com> (raw)
In-Reply-To: <302670f20910071925g30322072oc9395e83d592ad2b@mail.gmail.com>
References: <302670f20910071925g30322072oc9395e83d592ad2b@mail.gmail.com>

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



view thread (2+ messages)

Message-ID: <4ACDA1CE.8060207@archonet.com>
Permalink:  ../4ACDA1CE.8060207@archonet.com/
Also on:    postgresql.org/message-id/4ACDA1CE.8060207@archonet.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: dev@archonet.com, gwchamb@gmail.com
  Subject: Re: Function Anomaly?
  In-Reply-To: <4ACDA1CE.8060207@archonet.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