Re: schema agnostic functions in language sql

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rob Sargent <robjsargent(at)gmail(dot)com>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: schema agnostic functions in language sql
Date: 2020-05-16 00:03:56
Message-ID: 19492.1589587436@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Rob Sargent <robjsargent(at)gmail(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Suhail Bamzena 2020-05-16 00:20:00 Re: Inherited an 18TB DB & need to backup
Previous Message Adrian Klaver 2020-05-16 00:02:38 Re: schema agnostic functions in language sql