1
0
mirror of https://github.com/postgres/postgres.git synced 2026-10-23 13:29:09 +03:00

Add a graph pattern variable only once

An element pattern variable may be repeated in the path pattern.
GraphTableParseState maintains a list of all variable names used in
the graph pattern.  Add a new variable name to that list only when it
is not present already.  This isn't a problem right now, but it could
be in the future.

Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Discussion: https://www.postgresql.org/message-id/CAExHW5tR4O0vjeqTCPr2VB5pYjNYbJgbCBEQf63NtU5Pz1MiOQ%40mail.gmail.com
This commit is contained in:
Peter Eisentraut
2026-03-27 10:49:49 +01:00
parent 98993150c0
commit 288ae96872

View File

@@ -231,7 +231,7 @@ transformGraphElementPattern(ParseState *pstate, GraphElementPattern *gep)
errmsg("element pattern quantifier is not supported")));
if (gep->variable)
gpstate->variables = lappend(gpstate->variables, makeString(pstrdup(gep->variable)));
gpstate->variables = list_append_unique(gpstate->variables, makeString(pstrdup(gep->variable)));
gep->labelexpr = transformLabelExpr(gpstate, gep->labelexpr);