From 7b1c2a0f2066672b24f6257ec9b8d78a1754f494 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Wed, 8 Oct 2014 18:10:47 -0300 Subject: [PATCH] Split builtins.h to a new header ruleutils.h The new header contains many prototypes for functions in ruleutils.c that are not exposed to the SQL level. Reviewed by Andres Freund and Michael Paquier. --- src/backend/access/index/genam.c | 1 + src/backend/catalog/heap.c | 1 + src/backend/commands/explain.c | 1 + src/backend/commands/tablecmds.c | 1 + src/backend/commands/typecmds.c | 1 + src/backend/utils/adt/misc.c | 1 + src/backend/utils/adt/ruleutils.c | 1 + src/include/utils/builtins.h | 11 ---------- src/include/utils/ruleutils.h | 34 +++++++++++++++++++++++++++++++ 9 files changed, 41 insertions(+), 11 deletions(-) create mode 100644 src/include/utils/ruleutils.h diff --git a/src/backend/access/index/genam.c b/src/backend/access/index/genam.c index 850008b340..8849c08e54 100644 --- a/src/backend/access/index/genam.c +++ b/src/backend/access/index/genam.c @@ -28,6 +28,7 @@ #include "utils/builtins.h" #include "utils/lsyscache.h" #include "utils/rel.h" +#include "utils/ruleutils.h" #include "utils/snapmgr.h" #include "utils/tqual.h" diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c index 55c1e79563..c0eade0a3d 100644 --- a/src/backend/catalog/heap.c +++ b/src/backend/catalog/heap.c @@ -69,6 +69,7 @@ #include "utils/inval.h" #include "utils/lsyscache.h" #include "utils/rel.h" +#include "utils/ruleutils.h" #include "utils/snapmgr.h" #include "utils/syscache.h" #include "utils/tqual.h" diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index 781a736115..49963ff429 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -28,6 +28,7 @@ #include "utils/json.h" #include "utils/lsyscache.h" #include "utils/rel.h" +#include "utils/ruleutils.h" #include "utils/snapmgr.h" #include "utils/tuplesort.h" #include "utils/xml.h" diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index cb16c53a60..d9263e320b 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -85,6 +85,7 @@ #include "utils/lsyscache.h" #include "utils/memutils.h" #include "utils/relcache.h" +#include "utils/ruleutils.h" #include "utils/snapmgr.h" #include "utils/syscache.h" #include "utils/tqual.h" diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c index ad364efbcb..55a68810f2 100644 --- a/src/backend/commands/typecmds.c +++ b/src/backend/commands/typecmds.c @@ -72,6 +72,7 @@ #include "utils/lsyscache.h" #include "utils/memutils.h" #include "utils/rel.h" +#include "utils/ruleutils.h" #include "utils/snapmgr.h" #include "utils/syscache.h" #include "utils/tqual.h" diff --git a/src/backend/utils/adt/misc.c b/src/backend/utils/adt/misc.c index 4eeb6314fa..67539ecde9 100644 --- a/src/backend/utils/adt/misc.c +++ b/src/backend/utils/adt/misc.c @@ -35,6 +35,7 @@ #include "storage/proc.h" #include "storage/procarray.h" #include "utils/lsyscache.h" +#include "utils/ruleutils.h" #include "tcop/tcopprot.h" #include "utils/builtins.h" #include "utils/timestamp.h" diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index 6e41cbd142..24ade6cc20 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -55,6 +55,7 @@ #include "utils/fmgroids.h" #include "utils/lsyscache.h" #include "utils/rel.h" +#include "utils/ruleutils.h" #include "utils/snapmgr.h" #include "utils/syscache.h" #include "utils/tqual.h" diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h index d88e7a3b26..fb1b4a42dd 100644 --- a/src/include/utils/builtins.h +++ b/src/include/utils/builtins.h @@ -676,13 +676,10 @@ extern Datum pg_get_viewdef_name(PG_FUNCTION_ARGS); extern Datum pg_get_viewdef_name_ext(PG_FUNCTION_ARGS); extern Datum pg_get_indexdef(PG_FUNCTION_ARGS); extern Datum pg_get_indexdef_ext(PG_FUNCTION_ARGS); -extern char *pg_get_indexdef_string(Oid indexrelid); -extern char *pg_get_indexdef_columns(Oid indexrelid, bool pretty); extern Datum pg_get_triggerdef(PG_FUNCTION_ARGS); extern Datum pg_get_triggerdef_ext(PG_FUNCTION_ARGS); extern Datum pg_get_constraintdef(PG_FUNCTION_ARGS); extern Datum pg_get_constraintdef_ext(PG_FUNCTION_ARGS); -extern char *pg_get_constraintdef_string(Oid constraintId); extern Datum pg_get_expr(PG_FUNCTION_ARGS); extern Datum pg_get_expr_ext(PG_FUNCTION_ARGS); extern Datum pg_get_userbyid(PG_FUNCTION_ARGS); @@ -692,17 +689,9 @@ extern Datum pg_get_function_arguments(PG_FUNCTION_ARGS); extern Datum pg_get_function_identity_arguments(PG_FUNCTION_ARGS); extern Datum pg_get_function_result(PG_FUNCTION_ARGS); extern Datum pg_get_function_arg_default(PG_FUNCTION_ARGS); -extern char *deparse_expression(Node *expr, List *dpcontext, - bool forceprefix, bool showimplicit); -extern List *deparse_context_for(const char *aliasname, Oid relid); -extern List *deparse_context_for_planstate(Node *planstate, List *ancestors, - List *rtable, List *rtable_names); -extern List *select_rtable_names_for_explain(List *rtable, - Bitmapset *rels_used); extern const char *quote_identifier(const char *ident); extern char *quote_qualified_identifier(const char *qualifier, const char *ident); -extern char *generate_collation_name(Oid collid); /* tid.c */ diff --git a/src/include/utils/ruleutils.h b/src/include/utils/ruleutils.h new file mode 100644 index 0000000000..520b06653c --- /dev/null +++ b/src/include/utils/ruleutils.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * + * ruleutils.h + * Declarations for ruleutils.c + * + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/ruleutils.h + * + *------------------------------------------------------------------------- + */ +#ifndef RULEUTILS_H +#define RULEUTILS_H + +#include "nodes/nodes.h" +#include "nodes/parsenodes.h" +#include "nodes/pg_list.h" + + +extern char *pg_get_indexdef_string(Oid indexrelid); +extern char *pg_get_indexdef_columns(Oid indexrelid, bool pretty); + +extern char *pg_get_constraintdef_string(Oid constraintId); +extern char *deparse_expression(Node *expr, List *dpcontext, + bool forceprefix, bool showimplicit); +extern List *deparse_context_for(const char *aliasname, Oid relid); +extern List *deparse_context_for_planstate(Node *planstate, List *ancestors, + List *rtable, List *rtable_names); +extern List *select_rtable_names_for_explain(List *rtable, + Bitmapset *rels_used); +extern char *generate_collation_name(Oid collid); + +#endif /* RULEUTILS_H */ -- 2.40.0