Skip to content
Merged
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
6 changes: 4 additions & 2 deletions regress/expected/catalog.out
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,11 @@ SELECT count(*) FROM pg_namespace WHERE nspname = 'g';

-- invalid cases
SELECT create_graph(NULL);
ERROR: graph name must not be NULL
ERROR: graph name can not be NULL
SELECT drop_graph(NULL);
ERROR: graph name must not be NULL
ERROR: graph name can not be NULL
SELECT create_graph('');
ERROR: graph name can not be empty
--
-- alter_graph() RENAME function tests
--
Expand Down
2 changes: 1 addition & 1 deletion regress/sql/catalog.sql
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ SELECT count(*) FROM pg_namespace WHERE nspname = 'g';
-- invalid cases
SELECT create_graph(NULL);
SELECT drop_graph(NULL);

SELECT create_graph('');
--
-- alter_graph() RENAME function tests
--
Expand Down
11 changes: 9 additions & 2 deletions src/backend/commands/graph_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,18 @@ Datum create_graph(PG_FUNCTION_ARGS)
if (PG_ARGISNULL(0))
{
ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("graph name must not be NULL")));
errmsg("graph name can not be NULL")));
}
graph_name = PG_GETARG_NAME(0);

graph_name_str = NameStr(*graph_name);

if (strlen(graph_name_str) == 0)
{
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("graph name can not be empty")));
}
if (graph_exists(graph_name_str))
{
ereport(ERROR,
Expand Down Expand Up @@ -158,7 +165,7 @@ Datum drop_graph(PG_FUNCTION_ARGS)
if (PG_ARGISNULL(0))
{
ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("graph name must not be NULL")));
errmsg("graph name can not be NULL")));
}
graph_name = PG_GETARG_NAME(0);
cascade = PG_GETARG_BOOL(1);
Expand Down