Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/backend/catalog/ag_graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

/* a global variable for the GUC variable */
char *graph_path = NULL;
bool enableGraphDML = false;
bool enable_graph_dml = false;
bool cypher_allow_unsafe_ddl = false;

/* Potentially set by pg_upgrade_support functions */
Expand Down
5 changes: 3 additions & 2 deletions src/backend/commands/graphcmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,7 @@ deleteRelatedEdges(const char *vlab)
Oid agedge;
ListCell *lc;
List *edges = NIL;
bool temp_enable_graph_dml = enable_graph_dml;

graphoid = get_graph_path_oid();
vlabid = get_labname_labid(vlab, graphoid);
Expand Down Expand Up @@ -709,12 +710,12 @@ deleteRelatedEdges(const char *vlab)
if (ret != SPI_OK_CONNECT)
elog(ERROR, "deleteRelatedEdges: SPI_connect returned %d", ret);

enableGraphDML = true;
enable_graph_dml = true;
ret = SPI_execute(sql.data, false, 0);
if (ret != SPI_OK_DELETE)
elog(ERROR, "deleteRelatedEdges: SPI_execute returned %d: %s",
ret, sql.data);
enableGraphDML = false;
enable_graph_dml = temp_enable_graph_dml;

ret = SPI_finish();
if (ret != SPI_OK_FINISH)
Expand Down
6 changes: 3 additions & 3 deletions src/backend/parser/analyze.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ transformDeleteStmt(ParseState *pstate, DeleteStmt *stmt)

qry->commandType = CMD_DELETE;

if (RangeVarIsLabel(stmt->relation) && !enableGraphDML)
if (RangeVarIsLabel(stmt->relation) && !enable_graph_dml)
elog(ERROR, "DML query to graph objects is not allowed");

/* process the WITH clause independently of all else */
Expand Down Expand Up @@ -588,7 +588,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
bool isOnConflictUpdate;
AclMode targetPerms;

if (RangeVarIsLabel(stmt->relation) && !enableGraphDML)
if (RangeVarIsLabel(stmt->relation) && !enable_graph_dml)
elog(ERROR, "DML query to graph objects is not allowed");

/* There can't be any outer WITH to worry about */
Expand Down Expand Up @@ -2404,7 +2404,7 @@ transformUpdateStmt(ParseState *pstate, UpdateStmt *stmt)
ParseNamespaceItem *nsitem;
Node *qual;

if (RangeVarIsLabel(stmt->relation) && !enableGraphDML)
if (RangeVarIsLabel(stmt->relation) && !enable_graph_dml)
elog(ERROR, "DML query to graph objects is not allowed");

qry->commandType = CMD_UPDATE;
Expand Down
3 changes: 0 additions & 3 deletions src/backend/tcop/pquery.c
Original file line number Diff line number Diff line change
Expand Up @@ -846,9 +846,6 @@ PortalRun(Portal portal, long count, bool isTopLevel, bool run_once,
CurrentResourceOwner = saveResourceOwner;
PortalContext = savePortalContext;

/* todo: Is it using now? */
enableGraphDML = false;

PG_RE_THROW();
}
PG_END_TRY();
Expand Down
11 changes: 11 additions & 0 deletions src/backend/utils/misc/guc_tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -2058,6 +2058,17 @@ struct config_bool ConfigureNamesBool[] =
NULL, NULL, NULL
},

{
{"enable_graph_dml", PGC_SUSET, CLIENT_CONN_STATEMENT,
gettext_noop("Allows using SQL DML queries on graph objects."),
NULL,
GUC_SUPERUSER_ONLY
},
&enable_graph_dml,
false,
NULL, NULL, NULL
},

/* End-of-list marker */
{
{NULL, 0, 0, NULL, NULL}, NULL, false, NULL, NULL, NULL
Expand Down
1 change: 1 addition & 0 deletions src/backend/utils/misc/postgresql.conf.sample
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,7 @@
#enable_eager = off
#auto_gather_graphmeta = off
#cypher_allow_unsafe_ddl = off
#enable_graph_dml = off
#allow_null_properties = off
#enable_multiple_update = off
#graph_path = '' # graph/schema names
Expand Down
2 changes: 1 addition & 1 deletion src/include/catalog/ag_graph_fn.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "nodes/parsenodes.h"

extern char *graph_path;
extern bool enableGraphDML;
extern bool enable_graph_dml;
extern bool cypher_allow_unsafe_ddl;

extern char *get_graph_path(bool lookup_cache);
Expand Down
3 changes: 2 additions & 1 deletion src/test/regress/expected/sysviews.out
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ select name, setting from pg_settings where name like 'enable%';
enable_bitmapscan | on
enable_eager | on
enable_gathermerge | on
enable_graph_dml | off
enable_hashagg | on
enable_hashjoin | on
enable_incremental_sort | on
Expand All @@ -134,7 +135,7 @@ select name, setting from pg_settings where name like 'enable%';
enable_seqscan | on
enable_sort | on
enable_tidscan | on
(23 rows)
(24 rows)

-- Test that the pg_timezone_names and pg_timezone_abbrevs views are
-- more-or-less working. We can't test their contents in any great detail
Expand Down