Re: Stored function RETURNS table, but in some cases columns are missing - should I set them to NULL?

From: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>
To:
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Stored function RETURNS table, but in some cases columns are missing - should I set them to NULL?
Date: 2021-03-09 14:49:36
Message-ID: CAADeyWgXDkdT5bZNfr7R4EdPn+H5K6CpmvVnbr9+piBadXBjng@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom, you are so eagle eyed -

On Mon, Mar 8, 2021 at 8:53 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Alexander Farber <alexander(dot)farber(at)gmail(dot)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, " +
>
>
thank you and sorry for my silly mistake

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Radoslav Nedyalkov 2021-03-09 15:35:35 how to limit statement memory allocation
Previous Message Joe Conway 2021-03-09 13:26:49 Re: Question about when PostgreSQL 11.0 was released