On 2021-Sep-16, vignesh C wrote:
> diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
> index e3068a374e..c50bb570ea 100644
> --- a/src/backend/parser/gram.y
> +++ b/src/backend/parser/gram.y
Yeah, on a quick glance this looks all wrong. Your PublicationObjSpec
production should return a node with tag PublicationObjSpec, and
pubobj_expr should not exist at all -- that stuff is just making it all
more confusing.
I think it'd be something like this:
PublicationObjSpec:
ALL TABLES
{
$$ = makeNode(PublicationObjSpec);
$$->pubobjtype = PUBLICATIONOBJ_ALL_TABLES;
$$->location = @1;
}
| TABLE qualified_name
{
$$ = makeNode(PublicationObjSpec);
$$->pubobjtype = PUBLICATIONOBJ_TABLE;
$$->pubobj = $2;
$$->location = @1;
}
| ALL TABLES IN_P SCHEMA name
{
$$ = makeNode(PublicationObjSpec);
$$->pubobjtype = PUBLICATIONOBJ_ALL_TABLES_IN_SCHEMA;
$$->pubobj = makeRangeVar( ... $5 ... );
$$->location = @1;
}
| qualified_name
{
$$ = makeNode(PublicationObjSpec);
$$->pubobjtype = PUBLICATIONOBJ_CONTINUATION;
$$->pubobj = $1;
$$->location = @1;
};
You need a single object name under TABLE, not a list -- this was Tom's
point about needing post-processing to determine how to assign a type to
a object that's what I named PUBLICATIONOBJ_CONTINUATION here.
--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
"Puedes vivir sólo una vez, pero si lo haces bien, una vez es suficiente"