From: Rob Sargent <robjsargent@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: schema agnostic functions in language sql
Date: Sat, 16 May 2020 06:15:22 -0600
Message-ID: <01AD9083-259E-4F92-85E8-8A254E89716C@gmail.com> (raw)
In-Reply-To: <19492.1589587436@sss.pgh.pa.us>
References: <19492.1589587436@sss.pgh.pa.us>
> On May 15, 2020, at 6:03 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Rob Sargent <robjsargent@gmail.com> writes:
>> I cannot create a plain sql function unless the search_path covers any
>> table mentioned. Not the case when using plpgsql - no path needed.
>
> Oh, one of the things that's quite a lot different is the checking
> applied at function creation time ;-).
>
> For a SQL function, by default we'll try to parse and analyze the body, so
> any unknown tables will draw an error. plpgsql doesn't go further than a
> very crude syntax check.
>
> If you don't like that, you can set check_function_bodies = off while
> creating your SQL functions. But in any case, it's only related to what
> happens at execution if the search path is the same.
>
> regards, tom lane
And my fundamental error was thinking the parse of all create function calls was not language specific beyond syntax. Looking back, my use of sql functions has been for inline-able calculations reused in other plpgsql functions.
check_function_body=off may be what I want during the site install as the definitions should be correct in all aspects.
Thank you all
rjs
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: robjsargent@gmail.com, tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, adrian.klaver@aklaver.com
Subject: Re: schema agnostic functions in language sql
In-Reply-To: <01AD9083-259E-4F92-85E8-8A254E89716C@gmail.com>
References: <19492.1589587436@sss.pgh.pa.us> <01AD9083-259E-4F92-85E8-8A254E89716C@gmail.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