diff options
| author | Pavan Deolasee | 2011-10-04 08:19:44 +0000 |
|---|---|---|
| committer | Pavan Deolasee | 2011-10-04 08:19:44 +0000 |
| commit | 34ba88b93acf5dd8f06f8dd1b13061d4ca498ab2 (patch) | |
| tree | c08440c0c60d0e7cc670abcb318297567ec6f501 /src/include/utils | |
| parent | 9875b6a3170e02666ad2e4ad12460dd412800598 (diff) | |
Fix a server crash is query deparsing. PostgreSQL has introduced a new
API for query deparse since 9.1, but that works only for init-ed plans.
We were using that API on a Plan node where as it expects a PlanState node
to work on. This causes segfault, especially on a 32-bit machine, but the
code was wrong anyways.
We create dummy PlanState nodes for the purpose of deparse. Since the
use is quite limited right now, it works. But this is just a work-around
and in the long term, we should either add appropriate API for query
deparsing at planning time or move the logic of generating query string at
the execution time. The second option looks more promising, but the remote
join reduction logic may need some rework.
Diffstat (limited to 'src/include/utils')
| -rw-r--r-- | src/include/utils/builtins.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h index 0926c34d3d..b11db63ace 100644 --- a/src/include/utils/builtins.h +++ b/src/include/utils/builtins.h @@ -640,6 +640,10 @@ extern void deparse_query(Query *query, StringInfo buf, List *parentnamespace); extern List *deparse_context_for(const char *aliasname, Oid relid); extern List *deparse_context_for_planstate(Node *planstate, List *ancestors, List *rtable); +#ifdef PGXC +extern List *deparse_context_for_plan(Node *plan, List *ancestors, + List *rtable); +#endif extern const char *quote_identifier(const char *ident); extern char *quote_qualified_identifier(const char *qualifier, const char *ident); |
