Re: Help with CREATE FUNCTION

From: Kip Warner <kip(at)thevertigo(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Sándor Daku <daku(dot)sandor(at)gmail(dot)com>, "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Help with CREATE FUNCTION
Date: 2016-04-19 00:18:47
Message-ID: 1461025127.8977.5.camel@thevertigo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Mon, 2016-04-18 at 11:47 -0700, David G. Johnston wrote:
> http://www.postgresql.org/docs/9.4/interactive/plpgsql-control
> -structures.html#PLPGSQL-STATEMENTS-RETURNING
>
> Unlike with SQL language functions you must explicitly return values
> from
> pl/pgsql function. The documentation describes the various ways to
> accomplish this.

Hey David. I think what I'll do is not define the constants using the
CONSTANT syntax, but instead have them inline within the SELECT as I
had before. Since the query is never seen by a human, there's really no
reason to have to beautify it.

On a related note, if I SELECT my_function(123,4) and one of those row
IDs doesn't exist in my_table, it should probably error which it
doesn't do right now. What would be the most elegant way of handling
that scenario?

--
Kip Warner -- Senior Software Engineer
OpenPGP encrypted/signed mail preferred
http://www.thevertigo.com

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message David G. Johnston 2016-04-19 00:32:06 Re: Help with CREATE FUNCTION
Previous Message David G. Johnston 2016-04-18 18:47:04 Re: Help with CREATE FUNCTION