|From:||Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>|
|To:||Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>|
|Cc:||Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)lists(dot)postgresql(dot)org|
|Subject:||Re: Extending outfuncs support to utility statements|
|Views:||Raw Message | Whole Thread | Download mbox | Resend email|
> I left off the last one because it fails check-world: we now
> get through the core regression tests okay, but then the pg_dump
> tests fail on the new SQL function. To fix that, we would have
> to extend ruleutils.c's get_utility_query_def() to be able to
> fully reconstruct any legal utility query ... which seems like
> a pretty dauntingly large amount of tedious manual effort to
> start with, and then also a nontrivial additional requirement
> on any future patch that adds new utility syntax. Are we sure
> it's worth going there?
Thinking about that some more, I wondered if we'd even wish to
build such code, compared to just saving the original source text
for utility statements and printing that. Obviously, this loses
all the benefits of new-style SQL functions compared to old-style
... except that those benefits would be illusory anyway, since by
definition we have not done parse analysis on a utility statement.
So we *cannot* offer any useful guarantees about being search_path
change proof, following renames of referenced objects, preventing
drops of referenced objects, etc etc.
This makes me wonder if this is a feature we even want. If we
put it in, we'd have to add a bunch of disclaimers about how
utility statements behave entirely differently from DML statements.
Perhaps an interesting alternative is to allow a command along
the lines of
(of course that name is already taken) where we'd parse-analyze
the string-expression at function creation, but then the computed
string is executed as a SQL command in the runtime environment.
This would make it fairly clear which things you have guarantees
of and which you don't. It'd also offer a feature that the PLs
have but SQL functions traditionally haven't, ie execution of
Anyway, this is a bit far afield from the stated topic of this
thread. I think we should commit something approximately like
what I posted and then start a new thread specifically about
what we'd like to do about utility commands in new-style SQL
regards, tom lane
|Next Message||Peter Geoghegan||2022-09-22 21:41:21||Re: Making C function declaration parameter names consistent with corresponding definition names|
|Previous Message||James Coleman||2022-09-22 21:19:42||Re: Consider parallel for lateral subqueries with limit|