pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alexander Farber <alexander.farber@gmail.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Stored function RETURNS table, but in some cases columns are missing - should I set them to NULL?
Date: Mon, 08 Mar 2021 14:53:41 -0500
Message-ID: <1842232.1615233221@sss.pgh.pa.us> (raw)
In-Reply-To: <CAADeyWghZVDjeD7zRQGze6eeyrbiqmqJTq4yeSDXUn+HpZjyxw@mail.gmail.com>
References: <CAADeyWghZVDjeD7zRQGze6eeyrbiqmqJTq4yeSDXUn+HpZjyxw@mail.gmail.com>

Alexander Farber <alexander.farber@gmail.com> writes:
> However there are cases, when I only have the out_gid value, I do not want
> to return any other values.
> My question is: do I have to set the other OUT params explicitly to NULL?

plpgsql initializes them to null by default, I believe, just like ordinary
local variables.

> org.postgresql.util.PSQLException: ERROR: column "out_uid" does not exist|

This isn't related to what your function does internally.

I think the issue is you renamed out_uid to uid in your SELECT:

>    String SQL_JOIN_GAME               =
>            "SELECT " +
>                "out_uid    AS uid,    " +

			regards, tom lane





view thread (4+ messages)  latest in thread

Message-ID: <1842232.1615233221@sss.pgh.pa.us>
Permalink:  ../1842232.1615233221@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1842232.1615233221@sss.pgh.pa.us

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, alexander.farber@gmail.com
  Subject: Re: Stored function RETURNS table, but in some cases columns are missing - should I set them to NULL?
  In-Reply-To: <1842232.1615233221@sss.pgh.pa.us>
  References: <CAADeyWghZVDjeD7zRQGze6eeyrbiqmqJTq4yeSDXUn+HpZjyxw@mail.gmail.com> <1842232.1615233221@sss.pgh.pa.us>

* 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