postgresql/src/backend/utils
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
..
adt Implement SQL-spec RETURNS TABLE syntax for functions. 2008-07-18 03:32:53 +00:00
cache Adjust things so that the query_string of a cached plan and the sourceText of 2008-07-18 20:26:06 +00:00
error Increase PG_SYSLOG_LIMIT (the max line length sent to syslog()) from 128 to 2008-07-09 15:56:49 +00:00
fmgr Implement SQL-spec RETURNS TABLE syntax for functions. 2008-07-18 03:32:53 +00:00
hash Reduce the need for frontend programs to include "postgres.h" by refactoring 2008-03-27 03:57:34 +00:00
init Refactor XLogOpenRelation() and XLogReadBuffer() in preparation for relation 2008-06-12 09:12:31 +00:00
mb Fix compiler warning introduced by recent patch. Tsk tsk. 2008-06-18 23:08:47 +00:00
misc Add unchangeable GUC "variables" segment_size, wal_block_size, and 2008-07-10 22:08:17 +00:00
mmgr Adjust things so that the query_string of a cached plan and the sourceText of 2008-07-18 20:26:06 +00:00
resowner Improve our #include situation by moving pointer types away from the 2008-06-19 00:46:06 +00:00
sort Improve our #include situation by moving pointer types away from the 2008-06-19 00:46:06 +00:00
time Make sure we only try to free snapshots that have been passed through 2008-07-11 02:10:14 +00:00
.cvsignore Cleanup to ensure good state of derived files in tarballs. 2000-06-09 02:38:36 +00:00
Gen_dummy_probes.sed Enable probes to work with Mac OS X Leopard and other OSes that will 2008-03-17 19:44:41 +00:00
Gen_fmgrtab.pl Fix Gen_fmgrtab.sh to not rely on hard-wired knowledge of the column numbers 2008-06-23 17:54:30 +00:00
Gen_fmgrtab.sh Fix Gen_fmgrtab.sh to not rely on hard-wired knowledge of the column numbers 2008-06-23 17:54:30 +00:00
Makefile Enable probes to work with Mac OS X Leopard and other OSes that will 2008-03-17 19:44:41 +00:00
probes.d Correct two more copyrights found by updated script. 2008-01-02 02:42:06 +00:00