pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Provide an error cursor for "can't call an SRF here" errors.
2+ messages / 1 participants
[nested] [flat]

* pgsql: Provide an error cursor for "can't call an SRF here" errors.
@ 2017-04-18 17:21  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2017-04-18 17:21 UTC (permalink / raw)
  To: pgsql-committers

Provide an error cursor for "can't call an SRF here" errors.

Since it appears that v10 is going to move the goalposts by some amount
in terms of where you can and can't invoke set-returning functions,
arrange for the executor's "set-valued function called in context that
cannot accept a set" errors to include a syntax position if possible,
pointing to the specific SRF that can't be called where it's located.

The main bit of infrastructure needed for this is to make the query source
text accessible in the executor; but it turns out that commit 4c728f382
already did that.  We just need a new function executor_errposition()
modeled on parser_errposition(), and we're ready to rock.

While experimenting with this, I noted that the error position wasn't
properly reported if it occurred in a plpgsql FOR-over-query loop,
which turned out to be because SPI_cursor_open_internal wasn't providing
an error context callback during PortalStart.  Fix that.

There's a whole lot more that could be done with this infrastructure
now that it's there, but this is not the right time in the development
cycle for that sort of work.  Hence, resist the temptation to plaster
executor_errposition() calls everywhere ... for the moment.

Discussion: https://postgr.es/m/5263.1492471571@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e240a65c7dfc5ad80ab757ecb1aa9b9032c7f8ae

Modified Files
--------------
src/backend/executor/execExpr.c    |  4 +++-
src/backend/executor/execSRF.c     | 16 ++++++++++------
src/backend/executor/execUtils.c   | 33 +++++++++++++++++++++++++++++++++
src/backend/executor/spi.c         |  6 +++---
src/include/executor/executor.h    |  2 ++
src/test/regress/expected/tsrf.out |  6 ++++++
6 files changed, 57 insertions(+), 10 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Provide an error cursor for "can't subscript" error messages.
@ 2020-12-11 23:58  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2020-12-11 23:58 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Provide an error cursor for "can't subscript" error messages.

Commit c7aba7c14 didn't add this, but after more fooling with the
feature I feel that it'd be useful.  To make this possible, refactor
getSubscriptingRoutines() so that the caller is responsible for
throwing any error.  (In clauses.c, I just chose to make the
most conservative assumption rather than throwing an error.  We don't
expect failures there anyway really, so the code space for an error
message would be a poor investment.)

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/653aa603f501aa6e4865105a928cd13082ee7152

Modified Files
--------------
src/backend/executor/execExpr.c      | 8 ++++++++
src/backend/optimizer/util/clauses.c | 5 +++--
src/backend/parser/parse_node.c      | 6 ++++++
src/backend/utils/cache/lsyscache.c  | 7 ++-----
src/test/regress/expected/arrays.out | 2 ++
5 files changed, 21 insertions(+), 7 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2020-12-11 23:58 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-04-18 17:21 pgsql: Provide an error cursor for "can't call an SRF here" errors. Tom Lane <tgl@sss.pgh.pa.us>
2020-12-11 23:58 pgsql: Provide an error cursor for "can't subscript" error messages. Tom Lane <tgl@sss.pgh.pa.us>

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