Skip to content

Commit

Permalink
Initiaial PG15 (#1108)
Browse files Browse the repository at this point in the history
Initial PG15 version

Contributors

Panagiotis Foliadis <pfoliadis@hotmail.com>
Matheus Farias <matheusfarias519@gmail.com>
Mohamed Mokhtar <m.mokhtar@outlook.it>
Hannan Aamir <hannanaamir2000@gmail.com>

---------

Co-authored-by: John Gemignani <jrgemignani@gmail.com>
Co-authored-by: Muhammad Taha Naveed <m.taha.naveed27@gmail.com>
  • Loading branch information
3 people authored Jul 31, 2023
1 parent b2abfc4 commit d0f7faa
Show file tree
Hide file tree
Showing 13 changed files with 124 additions and 114 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</a>
&nbsp;
<a href="https://www.postgresql.org/docs/14/index.html">
<img src="https://img.shields.io/badge/Version-PostgreSQL 14-00008B?labelColor=gray&style=flat&link=https://www.postgresql.org/docs/14/index.html"/>
<img src="https://img.shields.io/badge/Version-Postgresql 15-00008B?labelColor=gray&style=flat&link=https://www.postgresql.org/docs/14/index.html"/>
</a>
&nbsp;
<a href="https://github.com/apache/age/issues">
Expand Down
2 changes: 1 addition & 1 deletion RELEASE
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.

Release Notes for Apache AGE release 0.0.0 for PG 14
Release Notes for Apache AGE release 0.0.0 for PG 15

Apache AGE 0.0.0 - Release Notes

Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RUN apt-get install --assume-yes --no-install-recommends --no-install-suggests \
bison \
build-essential \
flex \
postgresql-server-dev-14 \
postgresql-server-dev-15 \
locales

ENV LANG=en_US.UTF-8
Expand Down
4 changes: 2 additions & 2 deletions src/backend/catalog/ag_catalog.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ static bool is_age_drop(PlannedStmt *pstmt)

if (IsA(obj, String))
{
Value *val = (Value *)obj;
char *str = val->val.str;
String *val = (String *)obj;
char *str = val->sval;

if (!pg_strcasecmp(str, "age"))
return true;
Expand Down
4 changes: 2 additions & 2 deletions src/backend/commands/graph_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ static Oid create_schema_for_graph(const Name graph_name)
integer = SystemTypeName("int4");
data_type = makeDefElem("as", (Node *)integer, -1);
maxvalue = makeDefElem("maxvalue", (Node *)makeInteger(LABEL_ID_MAX), -1);
cycle = makeDefElem("cycle", (Node *)makeInteger(true), -1);
cycle = makeDefElem("cycle", (Node *)makeBoolean(true), -1);
seq_stmt->options = list_make3(data_type, maxvalue, cycle);
seq_stmt->ownerId = InvalidOid;
seq_stmt->for_identity = false;
Expand Down Expand Up @@ -198,7 +198,7 @@ Datum drop_graph(PG_FUNCTION_ARGS)
static void drop_schema_for_graph(char *graph_name_str, const bool cascade)
{
DropStmt *drop_stmt;
Value *schema_name;
String *schema_name;
List *label_id_seq_name;
DropBehavior behavior;

Expand Down
12 changes: 6 additions & 6 deletions src/backend/commands/label_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,12 +516,12 @@ static FuncCall *build_id_default_func_expr(char *graph_name, char *label_name,
label_id_func_name = list_make2(makeString("ag_catalog"),
makeString("_label_id"));
graph_name_const = makeNode(A_Const);
graph_name_const->val.type = T_String;
graph_name_const->val.val.str = graph_name;
graph_name_const->val.sval.type = T_String;
graph_name_const->val.sval.sval = graph_name;
graph_name_const->location = -1;
label_name_const = makeNode(A_Const);
label_name_const->val.type = T_String;
label_name_const->val.val.str = label_name;
label_name_const->val.sval.type = T_String;
label_name_const->val.sval.sval = label_name;
label_name_const->location = -1;
label_id_func_args = list_make2(graph_name_const, label_name_const);
label_id_func = makeFuncCall(label_id_func_name, label_id_func_args, COERCE_SQL_SYNTAX, -1);
Expand All @@ -530,8 +530,8 @@ static FuncCall *build_id_default_func_expr(char *graph_name, char *label_name,
nextval_func_name = SystemFuncName("nextval");
qualified_seq_name = quote_qualified_identifier(schema_name, seq_name);
qualified_seq_name_const = makeNode(A_Const);
qualified_seq_name_const->val.type = T_String;
qualified_seq_name_const->val.val.str = qualified_seq_name;
qualified_seq_name_const->val.sval.type = T_String;
qualified_seq_name_const->val.sval.sval = qualified_seq_name;
qualified_seq_name_const->location = -1;
regclass_cast = makeNode(TypeCast);
regclass_cast->typeName = SystemTypeName("regclass");
Expand Down
4 changes: 2 additions & 2 deletions src/backend/executor/cypher_delete.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,13 +377,13 @@ static void process_delete_list(CustomScanState *node)
ResultRelInfo *resultRelInfo;
HeapTuple heap_tuple;
char *label_name;
Value *pos;
Integer *pos;
int entity_position;

item = lfirst(lc);

pos = item->entity_position;
entity_position = pos->val.ival;
entity_position = pos->ival;

/* skip if the entity is null */
if (scanTupleSlot->tts_isnull[entity_position - 1])
Expand Down
2 changes: 1 addition & 1 deletion src/backend/parser/cypher_analyze.c
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ static Query *analyze_cypher_and_coerce(List *stmt, RangeTblFunction *rtfunc,


addNSItemToQuery(pstate, pnsi, true, true, true);
query->targetList = expandNSItemAttrs(pstate, pnsi, 0, -1);
query->targetList = expandNSItemAttrs(pstate, pnsi, 0, true, -1);

markTargetListOrigins(pstate, query->targetList);

Expand Down
53 changes: 27 additions & 26 deletions src/backend/parser/cypher_clause.c
Original file line number Diff line number Diff line change
Expand Up @@ -1341,7 +1341,7 @@ static Query *transform_cypher_unwind(cypher_parsestate *cpstate,
errmsg("invalid value for rtindex")));
}

query->targetList = expandNSItemAttrs(pstate, pnsi, 0, -1);
query->targetList = expandNSItemAttrs(pstate, pnsi, 0, true, -1);
}

target_syntax_loc = exprLocation((const Node *) self->target);
Expand Down Expand Up @@ -1400,7 +1400,8 @@ static List *transform_cypher_delete_item_list(cypher_parsestate *cpstate,
{
Node *expr = lfirst(lc);
ColumnRef *col;
Value *val, *pos;
String *val;
Integer *pos;
int resno;

cypher_delete_item *item = make_ag_node(cypher_delete_item);
Expand All @@ -1427,21 +1428,21 @@ static List *transform_cypher_delete_item_list(cypher_parsestate *cpstate,
(errmsg_internal("unexpected Node for cypher_clause")));
}

resno = get_target_entry_resno(query->targetList, val->val.str);
resno = get_target_entry_resno(query->targetList, val->sval);
if (resno == -1)
{
ereport(ERROR,
(errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
errmsg("undefined reference to variable %s in DELETE clause",
val->val.str),
val->sval),
parser_errposition(pstate, col->location)));
}

add_volatile_wrapper_to_target_entry(query->targetList, resno);

pos = makeInteger(resno);

item->var_name = val->val.str;
item->var_name = val->sval;
item->entity_position = pos;

items = lappend(items, item);
Expand Down Expand Up @@ -1539,7 +1540,7 @@ cypher_update_information *transform_cypher_remove_item_list(
ColumnRef *ref;
A_Indirection *ind;
char *variable_name, *property_name;
Value *property_node, *variable_node;
String *property_node, *variable_node;

item = make_ag_node(cypher_update_item);

Expand Down Expand Up @@ -1585,7 +1586,7 @@ cypher_update_information *transform_cypher_remove_item_list(

variable_node = linitial(ref->fields);

variable_name = variable_node->val.str;
variable_name = variable_node->sval;
item->var_name = variable_name;

item->entity_position = get_target_entry_resno(query->targetList,
Expand Down Expand Up @@ -1620,7 +1621,7 @@ cypher_update_information *transform_cypher_remove_item_list(
errmsg("REMOVE clause expects a property name"),
parser_errposition(pstate, set_item->location)));
}
property_name = property_node->val.str;
property_name = property_node->sval;
item->prop_name = property_name;

info->set_items = lappend(info->set_items, item);
Expand Down Expand Up @@ -1648,7 +1649,7 @@ cypher_update_information *transform_cypher_set_item_list(
ColumnRef *ref;
A_Indirection *ind;
char *variable_name, *property_name;
Value *property_node, *variable_node;
String *property_node, *variable_node;
int is_entire_prop_update = 0; // true if a map is assigned to variable

// LHS of set_item must be a variable or an indirection.
Expand Down Expand Up @@ -1748,7 +1749,7 @@ cypher_update_information *transform_cypher_set_item_list(
parser_errposition(pstate, set_item->location)));
}

property_name = property_node->val.str;
property_name = property_node->sval;
item->prop_name = property_name;
}

Expand All @@ -1762,7 +1763,7 @@ cypher_update_information *transform_cypher_set_item_list(
parser_errposition(pstate, set_item->location)));
}

variable_name = variable_node->val.str;
variable_name = variable_node->sval;
item->var_name = variable_name;

item->entity_position = get_target_entry_resno(query->targetList,
Expand Down Expand Up @@ -2330,7 +2331,7 @@ static Query *transform_cypher_clause_with_where(cypher_parsestate *cpstate,
* all the variables that are introduced in the previous clause to the
* next clause
*/
query->targetList = expandNSItemAttrs(pstate, pnsi, 0, -1);
query->targetList = expandNSItemAttrs(pstate, pnsi, 0, true, -1);

markTargetListOrigins(pstate, query->targetList);

Expand Down Expand Up @@ -2611,7 +2612,7 @@ static Query *transform_cypher_match_pattern(cypher_parsestate *cpstate,
* next clause
*/
pnsi = get_namespace_item(pstate, rte);
query->targetList = expandNSItemAttrs(pstate, pnsi, 0, -1);
query->targetList = expandNSItemAttrs(pstate, pnsi, 0, true, -1);
}

transform_match_pattern(cpstate, query, self->pattern, where);
Expand Down Expand Up @@ -3049,7 +3050,7 @@ static FuncCall *prevent_duplicate_edges(cypher_parsestate *cpstate,
List *edges = NIL;
ListCell *lc;
List *qualified_function_name;
Value *ag_catalog, *edge_fn;
String *ag_catalog, *edge_fn;

ag_catalog = makeString("ag_catalog");
edge_fn = makeString("_ag_enforce_edge_uniqueness");
Expand Down Expand Up @@ -3154,8 +3155,8 @@ static List *make_join_condition_for_edge(cypher_parsestate *cpstate,
{
Node *left_id = NULL;
Node *right_id = NULL;
Value *ag_catalog = makeString("ag_catalog");
Value *func_name;
String *ag_catalog = makeString("ag_catalog");
String *func_name;
List *qualified_func_name;
List *args = NIL;
List *quals = NIL;
Expand Down Expand Up @@ -3205,7 +3206,7 @@ static List *make_join_condition_for_edge(cypher_parsestate *cpstate,
prev_edge->type == ENT_VLE_EDGE)
{
List *qualified_name, *args;
Value *match_qual;
String *match_qual;
FuncCall *fc;

match_qual = makeString("age_match_two_vle_edges");
Expand Down Expand Up @@ -3348,8 +3349,8 @@ static List *make_join_condition_for_edge(cypher_parsestate *cpstate,
static Node *make_type_cast_to_agtype(Node *arg)
{
TypeCast *n = makeNode(TypeCast);
Value *ag_catalog = makeString("ag_catalog");
Value *agtype_str = makeString("agtype");
String *ag_catalog = makeString("ag_catalog");
String *agtype_str = makeString("agtype");
List *qualified_name = list_make2(ag_catalog, agtype_str);

n->arg = arg;
Expand All @@ -3366,8 +3367,8 @@ static Node *make_bool_a_const(bool state)
{
A_Const *n = makeNode(A_Const);

n->val.type = T_String;
n->val.val.str = (state ? "true" : "false");
n->val.sval.type = T_String;
n->val.sval.sval = (state ? "true" : "false");
n->location = -1;

// typecast to agtype
Expand Down Expand Up @@ -3416,7 +3417,7 @@ static List *join_to_entity(cypher_parsestate *cpstate,
else if (entity->type == ENT_VLE_EDGE)
{
List *qualified_name, *args;
Value *ag_catalog, *match_qual;
String *ag_catalog, *match_qual;
bool is_left_side;
FuncCall *fc;

Expand Down Expand Up @@ -3539,12 +3540,12 @@ static A_Expr *filter_vertices_on_label_id(cypher_parsestate *cpstate,
cpstate->graph_oid);
A_Const *n;
FuncCall *fc;
Value *ag_catalog, *extract_label_id;
String *ag_catalog, *extract_label_id;
int32 label_id = lcd->id;

n = makeNode(A_Const);
n->val.type = T_Integer;
n->val.val.ival = label_id;
n->val.ival.type = T_Integer;
n->val.ival.ival = label_id;
n->location = -1;

ag_catalog = makeString("ag_catalog");
Expand Down Expand Up @@ -6803,7 +6804,7 @@ static void handle_prev_clause(cypher_parsestate *cpstate, Query *query,
}

// add all the rte's attributes to the current queries targetlist
query->targetList = expandNSItemAttrs(pstate, pnsi, 0, -1);
query->targetList = expandNSItemAttrs(pstate, pnsi, 0, true, -1);
}

ParseNamespaceItem *find_pnsi(cypher_parsestate *cpstate, char *varname)
Expand Down
Loading

0 comments on commit d0f7faa

Please sign in to comment.