postgresql/src/backend/utils/cache
Tom Lane a1c692358b Adjust things so that the query_string of a cached plan and the sourceText of
a portal are never NULL, but reliably provide the source text of the query.
It turns out that there was only one place that was really taking a short-cut,
which was the 'EXECUTE' utility statement.  That doesn't seem like a
sufficiently critical performance hotspot to justify not offering a guarantee
of validity of the portal source text.  Fix it to copy the source text over
from the cached plan.  Add Asserts in the places that set up cached plans and
portals to reject null source strings, and simplify a bunch of places that
formerly needed to guard against nulls.

There may be a few places that cons up statements for execution without
having any source text at all; I found one such in ConvertTriggerToFK().
It seems sufficient to inject a phony source string in such a case,
for instance
        ProcessUtility((Node *) atstmt,
                       "(generated ALTER TABLE ADD FOREIGN KEY command)",
                       NULL, false, None_Receiver, NULL);

We should take a second look at the usage of debug_query_string,
particularly the recently added current_query() SQL function.

ITAGAKI Takahiro and Tom Lane
2008-07-18 20:26:06 +00:00
..
catcache.c Improve our #include situation by moving pointer types away from the 2008-06-19 00:46:06 +00:00
inval.c Rewrite the sinval messaging mechanism to reduce contention and avoid 2008-06-19 21:32:56 +00:00
lsyscache.c Since createplan.c no longer cares whether index operators are lossy, it has 2008-04-13 20:51:21 +00:00
Makefile Refactor backend makefiles to remove lots of duplicate code 2008-02-19 10:30:09 +00:00
plancache.c Adjust things so that the query_string of a cached plan and the sourceText of 2008-07-18 20:26:06 +00:00
relcache.c Restructure some header files a bit, in particular heapam.h, by removing some 2008-05-12 00:00:54 +00:00
syscache.c Improve our #include situation by moving pointer types away from the 2008-06-19 00:46:06 +00:00
ts_cache.c Create new routines systable_beginscan_ordered, systable_getnext_ordered, 2008-04-12 23:14:21 +00:00
typcache.c Improve our #include situation by moving pointer types away from the 2008-06-19 00:46:06 +00:00