pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Rob Sargent <robjsargent@gmail.com>
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: Fri, 15 May 2020 20:03:56 -0400
Message-ID: <19492.1589587436@sss.pgh.pa.us> (raw)
In-Reply-To: <23231c96-2ddb-92dd-5539-08925bfcf314@gmail.com>
References: <db508d6f-7e78-e57d-85f1-515353c66e43@gmail.com>
	<a15a707a-1c33-8d23-6133-ff1466234700@aklaver.com>
	<92aa43c7-6b96-ab7f-ddde-61346f957801@gmail.com>
	<fc17f5bc-51d0-6e38-9642-752618ae507e@aklaver.com>
	<cbea3b73-54e8-acd7-3f32-30c29ac30b26@gmail.com>
	<CAKFQuwYy5p3V6DmSn5-y91QUiWXQ75BPi9MChx+HQhK2=vveiQ@mail.gmail.com>
	<17840.1589586084@sss.pgh.pa.us>
	<23231c96-2ddb-92dd-5539-08925bfcf314@gmail.com>

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





view thread (15+ messages)  latest in thread

Message-ID: <19492.1589587436@sss.pgh.pa.us>
Permalink:  ../19492.1589587436@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/19492.1589587436@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, robjsargent@gmail.com, david.g.johnston@gmail.com, adrian.klaver@aklaver.com
  Subject: Re: schema agnostic functions in language sql
  In-Reply-To: <19492.1589587436@sss.pgh.pa.us>
  References: <db508d6f-7e78-e57d-85f1-515353c66e43@gmail.com> <a15a707a-1c33-8d23-6133-ff1466234700@aklaver.com> <92aa43c7-6b96-ab7f-ddde-61346f957801@gmail.com> <fc17f5bc-51d0-6e38-9642-752618ae507e@aklaver.com> <cbea3b73-54e8-acd7-3f32-30c29ac30b26@gmail.com> <CAKFQuwYy5p3V6DmSn5-y91QUiWXQ75BPi9MChx+HQhK2=vveiQ@mail.gmail.com> <17840.1589586084@sss.pgh.pa.us> <23231c96-2ddb-92dd-5539-08925bfcf314@gmail.com> <19492.1589587436@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