| From: | Rob Sargent <robjsargent(at)gmail(dot)com> |
|---|---|
| To: | pgsql-general(at)lists(dot)postgresql(dot)org |
| Subject: | schema agnostic functions in language sql |
| Date: | 2020-05-15 22:26:58 |
| Message-ID: | db508d6f-7e78-e57d-85f1-515353c66e43@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
I'm using postgres 12.2, with multiple identical schema per database
(each with a matching role). I can write public plpgsql functions
without using a schema identifier and let the runtime search_path find
the correct schema-dependent table. The same does not appear to be true
for plain sql functions. The 'parser'? does not recognize the tables
(sans schema qualifier):
ERROR: relation "<tablename>" does not exist.
I would rather not have to duplicate these across multiple schema - I'll
use plpgsql instead unless I've overlooked some other avenue.
I've found that I can create the function, in public, if I set the
search_path containing one schema (of course) and then successfully
access the function after resetting the search path to use a second
schema. My "build the world" scripting has so far avoided needing to
know/use any specific role. Another pipe dream vaporized?
Thanks,
rjs
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Adrian Klaver | 2020-05-15 22:43:44 | Re: schema agnostic functions in language sql |
| Previous Message | Ron | 2020-05-15 22:25:55 | Re: Inherited an 18TB DB & need to backup |