Re: pgsql: Adjust things so that the query_string of a cached plan and the

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)postgresql(dot)org>
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Adjust things so that the query_string of a cached plan and the
Date: 2008-12-16 00:07:48
Message-ID: 200812160007.mBG07m608123@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers


This commit mentions checking 'debug_query_string' again; exactly what
needs checking?

---------------------------------------------------------------------------

Tom Lane wrote:
> Log Message:
> -----------
> 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
>
> Modified Files:
> --------------
> pgsql/src/backend/commands:
> portalcmds.c (r1.74 -> r1.75)
> (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/portalcmds.c?r1=1.74&r2=1.75)
> prepare.c (r1.87 -> r1.88)
> (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/prepare.c?r1=1.87&r2=1.88)
> trigger.c (r1.235 -> r1.236)
> (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/trigger.c?r1=1.235&r2=1.236)
> pgsql/src/backend/executor:
> spi.c (r1.196 -> r1.197)
> (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/spi.c?r1=1.196&r2=1.197)
> pgsql/src/backend/parser:
> analyze.c (r1.372 -> r1.373)
> (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/analyze.c?r1=1.372&r2=1.373)
> pgsql/src/backend/tcop:
> postgres.c (r1.553 -> r1.554)
> (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/tcop/postgres.c?r1=1.553&r2=1.554)
> utility.c (r1.294 -> r1.295)
> (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/tcop/utility.c?r1=1.294&r2=1.295)
> pgsql/src/backend/utils/cache:
> plancache.c (r1.18 -> r1.19)
> (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/cache/plancache.c?r1=1.18&r2=1.19)
> pgsql/src/backend/utils/mmgr:
> portalmem.c (r1.110 -> r1.111)
> (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mmgr/portalmem.c?r1=1.110&r2=1.111)
> pgsql/src/include/utils:
> plancache.h (r1.11 -> r1.12)
> (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/utils/plancache.h?r1=1.11&r2=1.12)
> portal.h (r1.78 -> r1.79)
> (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/utils/portal.h?r1=1.78&r2=1.79)
>
> --
> Sent via pgsql-committers mailing list (pgsql-committers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-committers

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2008-12-16 00:18:48 Re: pgsql: Adjust things so that the query_string of a cached plan and the
Previous Message Bruce Momjian 2008-12-15 22:13:02 pgsql: Improve comment about why sleep is used by pg_standby to handle

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2008-12-16 00:10:15 Re: Patch to eliminate duplicate b64 code from pgcrypto
Previous Message Bruce Momjian 2008-12-15 23:46:00 Re: [ADMIN] shared_buffers and shmmax