Include schema-qualified names in publication error messages.
Include schema-qualified names in publication error messages.
Previously, error messages in check_publication_add_relation() only reported the relation name when a table could not be added to a publication or included in an EXCEPT clause. This could be ambiguous in databases where the same relation name exists in multiple schemas. This patch updates these error messages to use schema-qualified names, improving the clarity of error reporting for CREATE PUBLICATION and ALTER PUBLICATION commands. This has been discussed on another thread [1] [1] https://www.postgresql.org/message-id/CAFiTN-u3Si2XJM9PW0xVsOSoVfTGJZZq-TirZb3eON4rqG1EFw%40mail.gmail.com -- Regards, Dilip Kumar Google
Re: Include schema-qualified names in publication error messages.
От:
shveta malik <shveta.malik@gmail.com>
Дата:
On Tue, Apr 28, 2026 at 4:34 PM Dilip Kumar wrote: > > Previously, error messages in check_publication_add_relation() only > reported the relation name when a table could not be added to a > publication or included in an EXCEPT clause. This could be ambiguous > in databases where the same relation name exists in multiple schemas. > +1 > This patch updates these error messages to use schema-qualified names, > improving the clarity of error reporting for CREATE PUBLICATION and > ALTER PUBLICATION commands. > > This has been discussed on another thread [1] > The patch works well. I think we can pull out 'get_namespace_name_or_temp(RelationGetNamespace(targetrel))' and 'RelationGetRelationName(targetrel)' into local variables to reduce repetition and make the error paths a bit cleaner. const char *nspname = get_namespace_name_or_temp(RelationGetNamespace(targetrel)); const char *relname = RelationGetRelationName(targetrel); thanks Shveta
Re: Include schema-qualified names in publication error messages.
От:
Peter Smith <smithpb2250@gmail.com>
Дата:
On Tue, Apr 28, 2026 at 9:39 PM shveta malik wrote: > > On Tue, Apr 28, 2026 at 4:34 PM Dilip Kumar wrote: > > > > Previously, error messages in check_publication_add_relation() only > > reported the relation name when a table could not be added to a > > publication or included in an EXCEPT clause. This could be ambiguous > > in databases where the same relation name exists in multiple schemas. > > > > +1 > > > This patch updates these error messages to use schema-qualified names, > > improving the clarity of error reporting for CREATE PUBLICATION and > > ALTER PUBLICATION commands. > > > > This has been discussed on another thread [1] > > > > The patch works well. > > I think we can pull out > 'get_namespace_name_or_temp(RelationGetNamespace(targetrel))' and > 'RelationGetRelationName(targetrel)' into local variables to reduce > repetition and make the error paths a bit cleaner. > > const char *nspname = > get_namespace_name_or_temp(RelationGetNamespace(targetrel)); > const char *relname = RelationGetRelationName(targetrel); > How about having a dedicated function to return the fully qualified relation name you want, which can then substitute the single %s. e.g. errmsg(errormsg, get_qualified_relname(targetrel)), ... ====== Kind Regards, Peter Smith. Fujitsu Australia
Re: Include schema-qualified names in publication error messages.
От:
Dilip Kumar <dilipbalaut@gmail.com>
Дата:
On Wed, Apr 29, 2026 at 9:28 AM Peter Smith wrote: > > On Tue, Apr 28, 2026 at 9:39 PM shveta malik wrote: > > > > On Tue, Apr 28, 2026 at 4:34 PM Dilip Kumar wrote: > > > > > > Previously, error messages in check_publication_add_relation() only > > > reported the relation name when a table could not be added to a > > > publication or included in an EXCEPT clause. This could be ambiguous > > > in databases where the same relation name exists in multiple schemas. > > > > > > > +1 > > > > > This patch updates these error messages to use schema-qualified names, > > > improving the clarity of error reporting for CREATE PUBLICATION and > > > ALTER PUBLICATION commands. > > > > > > This has been discussed on another thread [1] > > > > > > > The patch works well. > > > > I think we can pull out > > 'get_namespace_name_or_temp(RelationGetNamespace(targetrel))' and > > 'RelationGetRelationName(targetrel)' into local variables to reduce > > repetition and make the error paths a bit cleaner. > > > > const char *nspname = > > get_namespace_name_or_temp(RelationGetNamespace(targetrel)); > > const char *relname = RelationGetRelationName(targetrel); > > > > How about having a dedicated function to return the fully qualified > relation name you want, which can then substitute the single %s. > > e.g. > errmsg(errormsg, get_qualified_relname(targetrel)), ... Yeah that makes sense. I will change this. -- Regards, Dilip Kumar Google
Re: Include schema-qualified names in publication error messages.
On Wed, Apr 29, 2026 at 4:08 PM Dilip Kumar wrote: > > On Wed, Apr 29, 2026 at 9:28 AM Peter Smith wrote: > > > > On Tue, Apr 28, 2026 at 9:39 PM shveta malik wrote: > > > > > > On Tue, Apr 28, 2026 at 4:34 PM Dilip Kumar wrote: > > > > > > > > Previously, error messages in check_publication_add_relation() only > > > > reported the relation name when a table could not be added to a > > > > publication or included in an EXCEPT clause. This could be ambiguous > > > > in databases where the same relation name exists in multiple schemas. > > > > > > > > > > +1 > > > > > > > This patch updates these error messages to use schema-qualified names, > > > > improving the clarity of error reporting for CREATE PUBLICATION and > > > > ALTER PUBLICATION commands. > > > > > > > > This has been discussed on another thread [1] > > > > > > > > > > The patch works well. > > > > > > I think we can pull out > > > 'get_namespace_name_or_temp(RelationGetNamespace(targetrel))' and > > > 'RelationGetRelationName(targetrel)' into local variables to reduce > > > repetition and make the error paths a bit cleaner. > > > > > > const char *nspname = > > > get_namespace_name_or_temp(RelationGetNamespace(targetrel)); > > > const char *relname = RelationGetRelationName(targetrel); > > > > > > > How about having a dedicated function to return the fully qualified > > relation name you want, which can then substitute the single %s. > > > > e.g. > > errmsg(errormsg, get_qualified_relname(targetrel)), ... > > Yeah that makes sense. I will change this. -- Regards, Dilip Kumar Google
Re: Include schema-qualified names in publication error messages.
От:
shveta malik <shveta.malik@gmail.com>
Дата:
On Wed, Apr 29, 2026 at 4:41 PM Dilip Kumar wrote: > > On Wed, Apr 29, 2026 at 4:08 PM Dilip Kumar wrote: > > > > On Wed, Apr 29, 2026 at 9:28 AM Peter Smith wrote: > > > > > > On Tue, Apr 28, 2026 at 9:39 PM shveta malik wrote: > > > > > > > > On Tue, Apr 28, 2026 at 4:34 PM Dilip Kumar wrote: > > > > > > > > > > Previously, error messages in check_publication_add_relation() only > > > > > reported the relation name when a table could not be added to a > > > > > publication or included in an EXCEPT clause. This could be ambiguous > > > > > in databases where the same relation name exists in multiple schemas. > > > > > > > > > > > > > +1 > > > > > > > > > This patch updates these error messages to use schema-qualified names, > > > > > improving the clarity of error reporting for CREATE PUBLICATION and > > > > > ALTER PUBLICATION commands. > > > > > > > > > > This has been discussed on another thread [1] > > > > > > > > > > > > > The patch works well. > > > > > > > > I think we can pull out > > > > 'get_namespace_name_or_temp(RelationGetNamespace(targetrel))' and > > > > 'RelationGetRelationName(targetrel)' into local variables to reduce > > > > repetition and make the error paths a bit cleaner. > > > > > > > > const char *nspname = > > > > get_namespace_name_or_temp(RelationGetNamespace(targetrel)); > > > > const char *relname = RelationGetRelationName(targetrel); > > > > > > > > > > How about having a dedicated function to return the fully qualified > > > relation name you want, which can then substitute the single %s. > > > > > > e.g. > > > errmsg(errormsg, get_qualified_relname(targetrel)), ... > > > > Yeah that makes sense. I will change this. > One trivial thing: +/* + * Get a palloc'd string containing the schema-qualified name of the relation. + */ Extra space here: 'name of' There is a similar function, generate_qualified_relation_name(), though I guess we can’t directly reuse it here. It takes a relid; while we could extract the OID from the Relation and call it, that seems a bit indirect when we already have the Relation in hand. In that case, a local helper here seems reasonable. Right? thanks Shveta
Re: Include schema-qualified names in publication error messages.
On Wed, Apr 29, 2026 at 5:02 PM shveta malik wrote: > > On Wed, Apr 29, 2026 at 4:41 PM Dilip Kumar wrote: > > > > On Wed, Apr 29, 2026 at 4:08 PM Dilip Kumar wrote: > > > > > > On Wed, Apr 29, 2026 at 9:28 AM Peter Smith wrote: > > > > > > > > On Tue, Apr 28, 2026 at 9:39 PM shveta malik wrote: > > > > > > > > > > On Tue, Apr 28, 2026 at 4:34 PM Dilip Kumar wrote: > > > > > > > > > > > > Previously, error messages in check_publication_add_relation() only > > > > > > reported the relation name when a table could not be added to a > > > > > > publication or included in an EXCEPT clause. This could be ambiguous > > > > > > in databases where the same relation name exists in multiple schemas. > > > > > > > > > > > > > > > > +1 > > > > > > > > > > > This patch updates these error messages to use schema-qualified names, > > > > > > improving the clarity of error reporting for CREATE PUBLICATION and > > > > > > ALTER PUBLICATION commands. > > > > > > > > > > > > This has been discussed on another thread [1] > > > > > > > > > > > > > > > > The patch works well. > > > > > > > > > > I think we can pull out > > > > > 'get_namespace_name_or_temp(RelationGetNamespace(targetrel))' and > > > > > 'RelationGetRelationName(targetrel)' into local variables to reduce > > > > > repetition and make the error paths a bit cleaner. > > > > > > > > > > const char *nspname = > > > > > get_namespace_name_or_temp(RelationGetNamespace(targetrel)); > > > > > const char *relname = RelationGetRelationName(targetrel); > > > > > > > > > > > > > How about having a dedicated function to return the fully qualified > > > > relation name you want, which can then substitute the single %s. > > > > > > > > e.g. > > > > errmsg(errormsg, get_qualified_relname(targetrel)), ... > > > > > > Yeah that makes sense. I will change this. > > > > One trivial thing: > +/* > + * Get a palloc'd string containing the schema-qualified name of the relation. > + */ > > Extra space here: 'name of' Oops, fixed now. > There is a similar function, generate_qualified_relation_name(), > though I guess we can’t directly reuse it here. It takes a relid; > while we could extract the OID from the Relation and call it, that > seems a bit indirect when we already have the Relation in hand. In > that case, a local helper here seems reasonable. Right? Yeah, we already have a relation descriptor, so it's better to use that. -- Regards, Dilip Kumar Google
Re: Include schema-qualified names in publication error messages.
От:
shveta malik <shveta.malik@gmail.com>
Дата:
On Wed, Apr 29, 2026 at 6:01 PM Dilip Kumar wrote: > > On Wed, Apr 29, 2026 at 5:02 PM shveta malik wrote: > > > > On Wed, Apr 29, 2026 at 4:41 PM Dilip Kumar wrote: > > > > > > On Wed, Apr 29, 2026 at 4:08 PM Dilip Kumar wrote: > > > > > > > > On Wed, Apr 29, 2026 at 9:28 AM Peter Smith wrote: > > > > > > > > > > On Tue, Apr 28, 2026 at 9:39 PM shveta malik wrote: > > > > > > > > > > > > On Tue, Apr 28, 2026 at 4:34 PM Dilip Kumar wrote: > > > > > > > > > > > > > > Previously, error messages in check_publication_add_relation() only > > > > > > > reported the relation name when a table could not be added to a > > > > > > > publication or included in an EXCEPT clause. This could be ambiguous > > > > > > > in databases where the same relation name exists in multiple schemas. > > > > > > > > > > > > > > > > > > > +1 > > > > > > > > > > > > > This patch updates these error messages to use schema-qualified names, > > > > > > > improving the clarity of error reporting for CREATE PUBLICATION and > > > > > > > ALTER PUBLICATION commands. > > > > > > > > > > > > > > This has been discussed on another thread [1] > > > > > > > > > > > > > > > > > > > The patch works well. > > > > > > > > > > > > I think we can pull out > > > > > > 'get_namespace_name_or_temp(RelationGetNamespace(targetrel))' and > > > > > > 'RelationGetRelationName(targetrel)' into local variables to reduce > > > > > > repetition and make the error paths a bit cleaner. > > > > > > > > > > > > const char *nspname = > > > > > > get_namespace_name_or_temp(RelationGetNamespace(targetrel)); > > > > > > const char *relname = RelationGetRelationName(targetrel); > > > > > > > > > > > > > > > > How about having a dedicated function to return the fully qualified > > > > > relation name you want, which can then substitute the single %s. > > > > > > > > > > e.g. > > > > > errmsg(errormsg, get_qualified_relname(targetrel)), ... > > > > > > > > Yeah that makes sense. I will change this. > > > > > > > One trivial thing: > > +/* > > + * Get a palloc'd string containing the schema-qualified name of the relation. > > + */ > > > > Extra space here: 'name of' > > Oops, fixed now. > > > There is a similar function, generate_qualified_relation_name(), > > though I guess we can’t directly reuse it here. It takes a relid; > > while we could extract the OID from the Relation and call it, that > > seems a bit indirect when we already have the Relation in hand. In > > that case, a local helper here seems reasonable. Right? > > Yeah, we already have a relation descriptor, so it's better to use that. > +static char *get_qualified_relname(Relation rel); This declaration seems unnecessary. We typically avoid adding one unless it’s required due to a later definition being used earlier. Other than that, the patch looks good. thanks Shveta
Re: Include schema-qualified names in publication error messages.
От:
Dilip Kumar <dilipbalaut@gmail.com>
Дата:
On Thu, Apr 30, 2026 at 9:47 AM shveta malik wrote: > > On Wed, Apr 29, 2026 at 6:01 PM Dilip Kumar wrote: > > > > On Wed, Apr 29, 2026 at 5:02 PM shveta malik wrote: > > > > > > On Wed, Apr 29, 2026 at 4:41 PM Dilip Kumar wrote: > > > > > > > > On Wed, Apr 29, 2026 at 4:08 PM Dilip Kumar wrote: > > > > > > > > > > On Wed, Apr 29, 2026 at 9:28 AM Peter Smith wrote: > > > > > > > > > > > > On Tue, Apr 28, 2026 at 9:39 PM shveta malik wrote: > > > > > > > > > > > > > > On Tue, Apr 28, 2026 at 4:34 PM Dilip Kumar wrote: > > > > > > > > > > > > > > > > Previously, error messages in check_publication_add_relation() only > > > > > > > > reported the relation name when a table could not be added to a > > > > > > > > publication or included in an EXCEPT clause. This could be ambiguous > > > > > > > > in databases where the same relation name exists in multiple schemas. > > > > > > > > > > > > > > > > > > > > > > +1 > > > > > > > > > > > > > > > This patch updates these error messages to use schema-qualified names, > > > > > > > > improving the clarity of error reporting for CREATE PUBLICATION and > > > > > > > > ALTER PUBLICATION commands. > > > > > > > > > > > > > > > > This has been discussed on another thread [1] > > > > > > > > > > > > > > > > > > > > > > The patch works well. > > > > > > > > > > > > > > I think we can pull out > > > > > > > 'get_namespace_name_or_temp(RelationGetNamespace(targetrel))' and > > > > > > > 'RelationGetRelationName(targetrel)' into local variables to reduce > > > > > > > repetition and make the error paths a bit cleaner. > > > > > > > > > > > > > > const char *nspname = > > > > > > > get_namespace_name_or_temp(RelationGetNamespace(targetrel)); > > > > > > > const char *relname = RelationGetRelationName(targetrel); > > > > > > > > > > > > > > > > > > > How about having a dedicated function to return the fully qualified > > > > > > relation name you want, which can then substitute the single %s. > > > > > > > > > > > > e.g. > > > > > > errmsg(errormsg, get_qualified_relname(targetrel)), ... > > > > > > > > > > Yeah that makes sense. I will change this. > > > > > > > > > > One trivial thing: > > > +/* > > > + * Get a palloc'd string containing the schema-qualified name of the relation. > > > + */ > > > > > > Extra space here: 'name of' > > > > Oops, fixed now. > > > > > There is a similar function, generate_qualified_relation_name(), > > > though I guess we can’t directly reuse it here. It takes a relid; > > > while we could extract the OID from the Relation and call it, that > > > seems a bit indirect when we already have the Relation in hand. In > > > that case, a local helper here seems reasonable. Right? > > > > Yeah, we already have a relation descriptor, so it's better to use that. > > > > +static char *get_qualified_relname(Relation rel); > > This declaration seems unnecessary. We typically avoid adding one > unless it’s required due to a later definition being used earlier. I generally prefer to add the static declaration irrespective of the order. I understand your point, but that isn't uniformly followed, though I prefer to add it. > Other than that, the patch looks good. Thanks. -- Regards, Dilip Kumar Google
Re: Include schema-qualified names in publication error messages.
От:
vignesh C <vignesh21@gmail.com>
Дата:
On Wed, 29 Apr 2026 at 18:02, Dilip Kumar wrote:
>
> On Wed, Apr 29, 2026 at 5:02 PM shveta malik wrote:
> >
> > On Wed, Apr 29, 2026 at 4:41 PM Dilip Kumar wrote:
> > >
> > > On Wed, Apr 29, 2026 at 4:08 PM Dilip Kumar wrote:
> > > >
> > > > On Wed, Apr 29, 2026 at 9:28 AM Peter Smith wrote:
> > > > >
> > > > > On Tue, Apr 28, 2026 at 9:39 PM shveta malik wrote:
> > > > > >
> > > > > > On Tue, Apr 28, 2026 at 4:34 PM Dilip Kumar wrote:
> > > > > > >
> > > > > > > Previously, error messages in check_publication_add_relation() only
> > > > > > > reported the relation name when a table could not be added to a
> > > > > > > publication or included in an EXCEPT clause. This could be ambiguous
> > > > > > > in databases where the same relation name exists in multiple schemas.
> > > > > > >
> > > > > >
> > > > > > +1
> > > > > >
> > > > > > > This patch updates these error messages to use schema-qualified names,
> > > > > > > improving the clarity of error reporting for CREATE PUBLICATION and
> > > > > > > ALTER PUBLICATION commands.
> > > > > > >
> > > > > > > This has been discussed on another thread [1]
> > > > > > >
> > > > > >
> > > > > > The patch works well.
> > > > > >
> > > > > > I think we can pull out
> > > > > > 'get_namespace_name_or_temp(RelationGetNamespace(targetrel))' and
> > > > > > 'RelationGetRelationName(targetrel)' into local variables to reduce
> > > > > > repetition and make the error paths a bit cleaner.
> > > > > >
> > > > > > const char *nspname =
> > > > > > get_namespace_name_or_temp(RelationGetNamespace(targetrel));
> > > > > > const char *relname = RelationGetRelationName(targetrel);
> > > > > >
> > > > >
> > > > > How about having a dedicated function to return the fully qualified
> > > > > relation name you want, which can then substitute the single %s.
> > > > >
> > > > > e.g.
> > > > > errmsg(errormsg, get_qualified_relname(targetrel)), ...
> > > >
> > > > Yeah that makes sense. I will change this.
> > >
> >
> > One trivial thing:
> > +/*
> > + * Get a palloc'd string containing the schema-qualified name of the relation.
> > + */
> >
> > Extra space here: 'name of'
>
> Oops, fixed now.
>
> > There is a similar function, generate_qualified_relation_name(),
> > though I guess we can’t directly reuse it here. It takes a relid;
> > while we could extract the OID from the Relation and call it, that
> > seems a bit indirect when we already have the Relation in hand. In
> > that case, a local helper here seems reasonable. Right?
>
> Yeah, we already have a relation descriptor, so it's better to use that.
We can remove the variables relname and result here by changing it to
something like:
static char *
get_qualified_relname(Relation rel)
{
char *nspname;
nspname = get_namespace_name_or_temp(RelationGetNamespace(rel));
if (!nspname)
elog(ERROR, "cache lookup failed for namespace %u",
RelationGetNamespace(rel));
return quote_qualified_identifier(nspname,
RelationGetRelationName(rel));
}
Regards,
Vignesh
Re: Include schema-qualified names in publication error messages.
От:
Dilip Kumar <dilipbalaut@gmail.com>
Дата:
On Thu, Apr 30, 2026 at 1:02 PM vignesh C wrote:
>
> On Wed, 29 Apr 2026 at 18:02, Dilip Kumar wrote:
> >
> > On Wed, Apr 29, 2026 at 5:02 PM shveta malik wrote:
> > >
> > > On Wed, Apr 29, 2026 at 4:41 PM Dilip Kumar wrote:
> > > >
> > > > On Wed, Apr 29, 2026 at 4:08 PM Dilip Kumar wrote:
> > > > >
> > > > > On Wed, Apr 29, 2026 at 9:28 AM Peter Smith wrote:
> > > > > >
> > > > > > On Tue, Apr 28, 2026 at 9:39 PM shveta malik wrote:
> > > > > > >
> > > > > > > On Tue, Apr 28, 2026 at 4:34 PM Dilip Kumar wrote:
> > > > > > > >
> > > > > > > > Previously, error messages in check_publication_add_relation() only
> > > > > > > > reported the relation name when a table could not be added to a
> > > > > > > > publication or included in an EXCEPT clause. This could be ambiguous
> > > > > > > > in databases where the same relation name exists in multiple schemas.
> > > > > > > >
> > > > > > >
> > > > > > > +1
> > > > > > >
> > > > > > > > This patch updates these error messages to use schema-qualified names,
> > > > > > > > improving the clarity of error reporting for CREATE PUBLICATION and
> > > > > > > > ALTER PUBLICATION commands.
> > > > > > > >
> > > > > > > > This has been discussed on another thread [1]
> > > > > > > >
> > > > > > >
> > > > > > > The patch works well.
> > > > > > >
> > > > > > > I think we can pull out
> > > > > > > 'get_namespace_name_or_temp(RelationGetNamespace(targetrel))' and
> > > > > > > 'RelationGetRelationName(targetrel)' into local variables to reduce
> > > > > > > repetition and make the error paths a bit cleaner.
> > > > > > >
> > > > > > > const char *nspname =
> > > > > > > get_namespace_name_or_temp(RelationGetNamespace(targetrel));
> > > > > > > const char *relname = RelationGetRelationName(targetrel);
> > > > > > >
> > > > > >
> > > > > > How about having a dedicated function to return the fully qualified
> > > > > > relation name you want, which can then substitute the single %s.
> > > > > >
> > > > > > e.g.
> > > > > > errmsg(errormsg, get_qualified_relname(targetrel)), ...
> > > > >
> > > > > Yeah that makes sense. I will change this.
> > > >
> > >
> > > One trivial thing:
> > > +/*
> > > + * Get a palloc'd string containing the schema-qualified name of the relation.
> > > + */
> > >
> > > Extra space here: 'name of'
> >
> > Oops, fixed now.
> >
> > > There is a similar function, generate_qualified_relation_name(),
> > > though I guess we can’t directly reuse it here. It takes a relid;
> > > while we could extract the OID from the Relation and call it, that
> > > seems a bit indirect when we already have the Relation in hand. In
> > > that case, a local helper here seems reasonable. Right?
> >
> > Yeah, we already have a relation descriptor, so it's better to use that.
>
> We can remove the variables relname and result here by changing it to
> something like:
> static char *
> get_qualified_relname(Relation rel)
> {
> char *nspname;
>
> nspname = get_namespace_name_or_temp(RelationGetNamespace(rel));
> if (!nspname)
> elog(ERROR, "cache lookup failed for namespace %u",
> RelationGetNamespace(rel));
>
> return quote_qualified_identifier(nspname,
> RelationGetRelationName(rel));
> }
Yeah we may, but I feel what we have now looks more readable.
--
Regards,
Dilip Kumar
Google
Re: Include schema-qualified names in publication error messages.
От:
"Euler Taveira" <euler@eulerto.com>
Дата:
On Thu, Apr 30, 2026, at 4:37 AM, Dilip Kumar wrote: > > Yeah we may, but I feel what we have now looks more readable. > My suggestion is that this function should be available in a central place. That's not the only place that could use qualified schema and relation. If you search for get_namespace_name_or_temp you will notice that this code path is repeated in other parts of the code too (see ruleutils.c). It would be good if we can have a common path for it. Maybe the signature has to be get_qualified_relname(Oid) to accommodate other cases. -- Euler Taveira EDB https://www.enterprisedb.com/
Re: Include schema-qualified names in publication error messages.
От:
Dilip Kumar <dilipbalaut@gmail.com>
Дата:
On Thu, 30 Apr 2026 at 7:14 PM, Euler Taveira <euler@eulerto.com> wrote:
On Thu, Apr 30, 2026, at 4:37 AM, Dilip Kumar wrote:
>
> Yeah we may, but I feel what we have now looks more readable.
>
My suggestion is that this function should be available in a central place.
That's not the only place that could use qualified schema and relation. If you
search for get_namespace_name_or_temp you will notice that this code path is
repeated in other parts of the code too (see ruleutils.c). It would be good if
we can have a common path for it. Maybe the signature has to be
get_qualified_relname(Oid) to accommodate
IMHO it’s not a good idea to use Oid when you already have reldesc.
—
Dilip
Re: Include schema-qualified names in publication error messages.
От:
shveta malik <shveta.malik@gmail.com>
Дата:
On Thu, Apr 30, 2026 at 7:23 PM Dilip Kumar wrote: > > On Thu, 30 Apr 2026 at 7:14 PM, Euler Taveira wrote: >> >> >> >> On Thu, Apr 30, 2026, at 4:37 AM, Dilip Kumar wrote: >> > >> > Yeah we may, but I feel what we have now looks more readable. >> > >> >> My suggestion is that this function should be available in a central place. >> That's not the only place that could use qualified schema and relation. If you >> search for get_namespace_name_or_temp you will notice that this code path is >> repeated in other parts of the code too (see ruleutils.c). It would be good if >> we can have a common path for it. Maybe the signature has to be >> get_qualified_relname(Oid) to accommodate > > > IMHO it’s not a good idea to use Oid when you already have reldesc. +1. I looked at other use cases of get_namespace_name_or_temp(), and there doesn’t seem to be any case where we already have a Relation descriptor. So this appears to be a unique scenario, and I feel adding a new function here makes sense. If needed, ruleutils.c’s generate_qualified_relation_name() could be moved to a common location in a separate patch. Thanks, Shveta
Re: Include schema-qualified names in publication error messages.
От:
Amit Kapila <amit.kapila16@gmail.com>
Дата:
On Mon, May 4, 2026 at 10:51 AM shveta malik wrote: > > On Thu, Apr 30, 2026 at 7:23 PM Dilip Kumar wrote: > > > > On Thu, 30 Apr 2026 at 7:14 PM, Euler Taveira wrote: > >> > >> > >> > >> On Thu, Apr 30, 2026, at 4:37 AM, Dilip Kumar wrote: > >> > > >> > Yeah we may, but I feel what we have now looks more readable. > >> > > >> > >> My suggestion is that this function should be available in a central place. > >> That's not the only place that could use qualified schema and relation. If you > >> search for get_namespace_name_or_temp you will notice that this code path is > >> repeated in other parts of the code too (see ruleutils.c). It would be good if > >> we can have a common path for it. Maybe the signature has to be > >> get_qualified_relname(Oid) to accommodate > > > > > > IMHO it’s not a good idea to use Oid when you already have reldesc. > > +1. > > I looked at other use cases of get_namespace_name_or_temp(), and there > doesn’t seem to be any case where we already have a Relation > descriptor. So this appears to be a unique scenario, and I feel adding > a new function here makes sense. If needed, ruleutils.c’s > generate_qualified_relation_name() could be moved to a common location > in a separate patch. > I think for HEAD, we can move the common part of generate_qualified_relation_name() and get_qualified_relname() to a common function that takes relname as input. We can probably move it to lsyscache.c. Now, we also need to decide whether to backpatch the relevant change to back-branches. It seems we didn't get the bug-report yet but clearly what we do currently is not correct. So, we should ideally backpatch it and in the back branches we don't need to expose it. OTOH, as it is reported and is not a big issue, so we can keep this as a HEAD only change as well. If we want to keep this as a HEAD only change then shall we wait for PG20 branch to open or go for current HEAD itself? What do you and or others think on this matter? -- With Regards, Amit Kapila.
Re: Include schema-qualified names in publication error messages.
От:
shveta malik <shveta.malik@gmail.com>
Дата:
On Tue, May 5, 2026 at 10:28 AM Amit Kapila wrote: > > On Mon, May 4, 2026 at 10:51 AM shveta malik wrote: > > > > On Thu, Apr 30, 2026 at 7:23 PM Dilip Kumar wrote: > > > > > > On Thu, 30 Apr 2026 at 7:14 PM, Euler Taveira wrote: > > >> > > >> > > >> > > >> On Thu, Apr 30, 2026, at 4:37 AM, Dilip Kumar wrote: > > >> > > > >> > Yeah we may, but I feel what we have now looks more readable. > > >> > > > >> > > >> My suggestion is that this function should be available in a central place. > > >> That's not the only place that could use qualified schema and relation. If you > > >> search for get_namespace_name_or_temp you will notice that this code path is > > >> repeated in other parts of the code too (see ruleutils.c). It would be good if > > >> we can have a common path for it. Maybe the signature has to be > > >> get_qualified_relname(Oid) to accommodate > > > > > > > > > IMHO it’s not a good idea to use Oid when you already have reldesc. > > > > +1. > > > > I looked at other use cases of get_namespace_name_or_temp(), and there > > doesn’t seem to be any case where we already have a Relation > > descriptor. So this appears to be a unique scenario, and I feel adding > > a new function here makes sense. If needed, ruleutils.c’s > > generate_qualified_relation_name() could be moved to a common location > > in a separate patch. > > > > I think for HEAD, we can move the common part of > generate_qualified_relation_name() and get_qualified_relname() to a > common function that takes relname as input. We can probably move it > to lsyscache.c. > > Now, we also need to decide whether to backpatch the relevant change > to back-branches. It seems we didn't get the bug-report yet but > clearly what we do currently is not correct. So, we should ideally > backpatch it and in the back branches we don't need to expose it. > OTOH, as it is reported and is not a big issue, so we can keep this as > a HEAD only change as well. +1, it is a rare error-case scenario and it has not been reported so far despite of change being present for a long time. So I think the HEAD-only change is good. > If we want to keep this as a HEAD only > change then shall we wait for PG20 branch to open or go for current > HEAD itself? What do you and or others think on this matter? > I am fine with both. Again, a rare scenario that hasn't reported yet, we can wait for the Pg20 branch to open. thanks Shveta
Re: Include schema-qualified names in publication error messages.
On Tue, May 5, 2026 at 10:27 AM Amit Kapila wrote: > > On Mon, May 4, 2026 at 10:51 AM shveta malik wrote: > > > > On Thu, Apr 30, 2026 at 7:23 PM Dilip Kumar wrote: > > > > > > On Thu, 30 Apr 2026 at 7:14 PM, Euler Taveira wrote: > > >> > > >> > > >> > > >> On Thu, Apr 30, 2026, at 4:37 AM, Dilip Kumar wrote: > > >> > > > >> > Yeah we may, but I feel what we have now looks more readable. > > >> > > > >> > > >> My suggestion is that this function should be available in a central place. > > >> That's not the only place that could use qualified schema and relation. If you > > >> search for get_namespace_name_or_temp you will notice that this code path is > > >> repeated in other parts of the code too (see ruleutils.c). It would be good if > > >> we can have a common path for it. Maybe the signature has to be > > >> get_qualified_relname(Oid) to accommodate > > > > > > > > > IMHO it’s not a good idea to use Oid when you already have reldesc. > > > > +1. > > > > I looked at other use cases of get_namespace_name_or_temp(), and there > > doesn’t seem to be any case where we already have a Relation > > descriptor. So this appears to be a unique scenario, and I feel adding > > a new function here makes sense. If needed, ruleutils.c’s > > generate_qualified_relation_name() could be moved to a common location > > in a separate patch. > > > > I think for HEAD, we can move the common part of > generate_qualified_relation_name() and get_qualified_relname() to a > common function that takes relname as input. We can probably move it > to lsyscache.c. Done that, I think we need to pass nspid and relname. > Now, we also need to decide whether to backpatch the relevant change > to back-branches. It seems we didn't get the bug-report yet but > clearly what we do currently is not correct. So, we should ideally > backpatch it and in the back branches we don't need to expose it. > OTOH, as it is reported and is not a big issue, so we can keep this as > a HEAD only change as well. If we want to keep this as a HEAD only > change then shall we wait for PG20 branch to open or go for current > HEAD itself? What do you and or others think on this matter? I think we should apply in PG19. Although back-patching isn't critical, since we already have an opportunity to fix it in PG19, why not push it early? -- Regards, Dilip Kumar Google
Re: Include schema-qualified names in publication error messages.
От:
Amit Kapila <amit.kapila16@gmail.com>
Дата:
On Tue, May 5, 2026 at 4:02 PM Dilip Kumar wrote: > > > Now, we also need to decide whether to backpatch the relevant change > > to back-branches. It seems we didn't get the bug-report yet but > > clearly what we do currently is not correct. So, we should ideally > > backpatch it and in the back branches we don't need to expose it. > > OTOH, as it is reported and is not a big issue, so we can keep this as > > a HEAD only change as well. If we want to keep this as a HEAD only > > change then shall we wait for PG20 branch to open or go for current > > HEAD itself? What do you and or others think on this matter? > > I think we should apply in PG19. Although back-patching isn't > critical, since we already have an opportunity to fix it in PG19, why > not push it early? > I also think we should push it for PG19 especially because the EXCEPT feature increased the usage of relation names without schema-name in error messages. However, as we are past feature freeze, I wanted to know the opinion of others as well. -- With Regards, Amit Kapila.
Re: Include schema-qualified names in publication error messages.
От:
"Euler Taveira" <euler@eulerto.com>
Дата:
On Tue, May 5, 2026, at 7:42 AM, Amit Kapila wrote: > On Tue, May 5, 2026 at 4:02 PM Dilip Kumar wrote: >> >> > Now, we also need to decide whether to backpatch the relevant change >> > to back-branches. It seems we didn't get the bug-report yet but >> > clearly what we do currently is not correct. So, we should ideally >> > backpatch it and in the back branches we don't need to expose it. >> > OTOH, as it is reported and is not a big issue, so we can keep this as >> > a HEAD only change as well. If we want to keep this as a HEAD only >> > change then shall we wait for PG20 branch to open or go for current >> > HEAD itself? What do you and or others think on this matter? >> >> I think we should apply in PG19. Although back-patching isn't >> critical, since we already have an opportunity to fix it in PG19, why >> not push it early? >> > > I also think we should push it for PG19 especially because the EXCEPT > feature increased the usage of relation names without schema-name in > error messages. However, as we are past feature freeze, I wanted to > know the opinion of others as well. > -1 for backpatching. These messages (without schema qualification) has been like this since the beginning. The function was not introduced by fd366065e06a and the proposed patch are changing existing messages as well. It is a good idea to keep visible messages (WARNING, ERROR, FATAL, PANIC) consistent so as not to break log analysis tools. I would say the target is v20. However, as Amit said, the change to the EXCEPT clause message might be important, so I suggest changing it; I would leave the other messages for the RMT to decide. PS> since we don't have a REL_19_STABLE branch yet, backpatch refers to v18 or earlier. -- Euler Taveira EDB https://www.enterprisedb.com/
Re: Include schema-qualified names in publication error messages.
От:
Amit Kapila <amit.kapila16@gmail.com>
Дата:
On Tue, May 5, 2026 at 5:56 PM Euler Taveira wrote: > > On Tue, May 5, 2026, at 7:42 AM, Amit Kapila wrote: > > On Tue, May 5, 2026 at 4:02 PM Dilip Kumar wrote: > >> > >> > Now, we also need to decide whether to backpatch the relevant change > >> > to back-branches. It seems we didn't get the bug-report yet but > >> > clearly what we do currently is not correct. So, we should ideally > >> > backpatch it and in the back branches we don't need to expose it. > >> > OTOH, as it is reported and is not a big issue, so we can keep this as > >> > a HEAD only change as well. If we want to keep this as a HEAD only > >> > change then shall we wait for PG20 branch to open or go for current > >> > HEAD itself? What do you and or others think on this matter? > >> > >> I think we should apply in PG19. Although back-patching isn't > >> critical, since we already have an opportunity to fix it in PG19, why > >> not push it early? > >> > > > > I also think we should push it for PG19 especially because the EXCEPT > > feature increased the usage of relation names without schema-name in > > error messages. However, as we are past feature freeze, I wanted to > > know the opinion of others as well. > > > > -1 for backpatching. > Agreed. > These messages (without schema qualification) has been > like this since the beginning. The function was not introduced by fd366065e06a > and the proposed patch are changing existing messages as well. It is a good > idea to keep visible messages (WARNING, ERROR, FATAL, PANIC) consistent so as > not to break log analysis tools. > > I would say the target is v20. However, as Amit said, the change to the EXCEPT > clause message might be important, so I suggest changing it; I would leave the > other messages for the RMT to decide. > Okay, then we can split the patch into two, the first patch to make the required changes only for EXCEPT, and the second one for the remaining pre-existing messages. We can push the first patch in HEAD and wait for some more opinions on the second one. -- With Regards, Amit Kapila.
Re: Include schema-qualified names in publication error messages.
On Wed, 6 May 2026 at 09:27, Amit Kapila wrote: > > On Tue, May 5, 2026 at 5:56 PM Euler Taveira wrote: > > > > On Tue, May 5, 2026, at 7:42 AM, Amit Kapila wrote: > > > On Tue, May 5, 2026 at 4:02 PM Dilip Kumar wrote: > > >> > > >> > Now, we also need to decide whether to backpatch the relevant change > > >> > to back-branches. It seems we didn't get the bug-report yet but > > >> > clearly what we do currently is not correct. So, we should ideally > > >> > backpatch it and in the back branches we don't need to expose it. > > >> > OTOH, as it is reported and is not a big issue, so we can keep this as > > >> > a HEAD only change as well. If we want to keep this as a HEAD only > > >> > change then shall we wait for PG20 branch to open or go for current > > >> > HEAD itself? What do you and or others think on this matter? > > >> > > >> I think we should apply in PG19. Although back-patching isn't > > >> critical, since we already have an opportunity to fix it in PG19, why > > >> not push it early? > > >> > > > > > > I also think we should push it for PG19 especially because the EXCEPT > > > feature increased the usage of relation names without schema-name in > > > error messages. However, as we are past feature freeze, I wanted to > > > know the opinion of others as well. > > > > > > > -1 for backpatching. > > > > Agreed. > > > These messages (without schema qualification) has been > > like this since the beginning. The function was not introduced by fd366065e06a > > and the proposed patch are changing existing messages as well. It is a good > > idea to keep visible messages (WARNING, ERROR, FATAL, PANIC) consistent so as > > not to break log analysis tools. > > > > I would say the target is v20. However, as Amit said, the change to the EXCEPT > > clause message might be important, so I suggest changing it; I would leave the > > other messages for the RMT to decide. > > > > Okay, then we can split the patch into two, the first patch to make > the required changes only for EXCEPT, and the second one for the > remaining pre-existing messages. We can push the first patch in HEAD > and wait for some more opinions on the second one. The updated patch has the changes to split it. Regards, Vignesh
Re: Include schema-qualified names in publication error messages.
От:
shveta malik <shveta.malik@gmail.com>
Дата:
On Thu, May 7, 2026 at 11:30 AM vignesh C wrote: > > On Wed, 6 May 2026 at 09:27, Amit Kapila wrote: > > > > On Tue, May 5, 2026 at 5:56 PM Euler Taveira wrote: > > > > > > On Tue, May 5, 2026, at 7:42 AM, Amit Kapila wrote: > > > > On Tue, May 5, 2026 at 4:02 PM Dilip Kumar wrote: > > > >> > > > >> > Now, we also need to decide whether to backpatch the relevant change > > > >> > to back-branches. It seems we didn't get the bug-report yet but > > > >> > clearly what we do currently is not correct. So, we should ideally > > > >> > backpatch it and in the back branches we don't need to expose it. > > > >> > OTOH, as it is reported and is not a big issue, so we can keep this as > > > >> > a HEAD only change as well. If we want to keep this as a HEAD only > > > >> > change then shall we wait for PG20 branch to open or go for current > > > >> > HEAD itself? What do you and or others think on this matter? > > > >> > > > >> I think we should apply in PG19. Although back-patching isn't > > > >> critical, since we already have an opportunity to fix it in PG19, why > > > >> not push it early? > > > >> > > > > > > > > I also think we should push it for PG19 especially because the EXCEPT > > > > feature increased the usage of relation names without schema-name in > > > > error messages. However, as we are past feature freeze, I wanted to > > > > know the opinion of others as well. > > > > > > > > > > -1 for backpatching. > > > > > > > Agreed. > > > > > These messages (without schema qualification) has been > > > like this since the beginning. The function was not introduced by fd366065e06a > > > and the proposed patch are changing existing messages as well. It is a good > > > idea to keep visible messages (WARNING, ERROR, FATAL, PANIC) consistent so as > > > not to break log analysis tools. > > > > > > I would say the target is v20. However, as Amit said, the change to the EXCEPT > > > clause message might be important, so I suggest changing it; I would leave the > > > other messages for the RMT to decide. > > > > > > > Okay, then we can split the patch into two, the first patch to make > > the required changes only for EXCEPT, and the second one for the > > remaining pre-existing messages. We can push the first patch in HEAD > > and wait for some more opinions on the second one. > > The updated patch has the changes to split it. > Thanks Vignesh. +/* + * get_qualified_relname + * Get a palloc'd string containing the schema-qualified name of the relation + * for the given namespace ID and relation name. + */ +char * +get_qualified_relname(Oid nspid, char *relname) I think, instead of get_qualified_relname(), we should have generic get_qualified_objname(), so that others can also use it. For example, see the usage of 'get_namespace_name_or_temp' in getObjectIdentityParts(), generate_function_name(), generate_qualified_type_name(), generate_collation_name() etc, we use it to get schema-qualified collation names, stats names, dict names, function name, type-name etc. Making the new function generic will help most of the other places where we use get_namespace_name_or_temp(). thanks Shveta
Re: Include schema-qualified names in publication error messages.
On Thu, May 7, 2026 at 3:03 PM shveta malik wrote: > > On Thu, May 7, 2026 at 11:30 AM vignesh C wrote: > > > > On Wed, 6 May 2026 at 09:27, Amit Kapila wrote: > > > > > > On Tue, May 5, 2026 at 5:56 PM Euler Taveira wrote: > > > > > > > > On Tue, May 5, 2026, at 7:42 AM, Amit Kapila wrote: > > > > > On Tue, May 5, 2026 at 4:02 PM Dilip Kumar wrote: > > > > >> > > > > >> > Now, we also need to decide whether to backpatch the relevant change > > > > >> > to back-branches. It seems we didn't get the bug-report yet but > > > > >> > clearly what we do currently is not correct. So, we should ideally > > > > >> > backpatch it and in the back branches we don't need to expose it. > > > > >> > OTOH, as it is reported and is not a big issue, so we can keep this as > > > > >> > a HEAD only change as well. If we want to keep this as a HEAD only > > > > >> > change then shall we wait for PG20 branch to open or go for current > > > > >> > HEAD itself? What do you and or others think on this matter? > > > > >> > > > > >> I think we should apply in PG19. Although back-patching isn't > > > > >> critical, since we already have an opportunity to fix it in PG19, why > > > > >> not push it early? > > > > >> > > > > > > > > > > I also think we should push it for PG19 especially because the EXCEPT > > > > > feature increased the usage of relation names without schema-name in > > > > > error messages. However, as we are past feature freeze, I wanted to > > > > > know the opinion of others as well. > > > > > > > > > > > > > -1 for backpatching. > > > > > > > > > > Agreed. > > > > > > > These messages (without schema qualification) has been > > > > like this since the beginning. The function was not introduced by fd366065e06a > > > > and the proposed patch are changing existing messages as well. It is a good > > > > idea to keep visible messages (WARNING, ERROR, FATAL, PANIC) consistent so as > > > > not to break log analysis tools. > > > > > > > > I would say the target is v20. However, as Amit said, the change to the EXCEPT > > > > clause message might be important, so I suggest changing it; I would leave the > > > > other messages for the RMT to decide. > > > > > > > > > > Okay, then we can split the patch into two, the first patch to make > > > the required changes only for EXCEPT, and the second one for the > > > remaining pre-existing messages. We can push the first patch in HEAD > > > and wait for some more opinions on the second one. > > > > The updated patch has the changes to split it. > > > > Thanks Vignesh. > > +/* > + * get_qualified_relname > + * Get a palloc'd string containing the schema-qualified name of the relation > + * for the given namespace ID and relation name. > + */ > +char * > +get_qualified_relname(Oid nspid, char *relname) > > I think, instead of get_qualified_relname(), we should have generic > get_qualified_objname(), so that others can also use it. > That makes sense. I have changed that in the attached and made slight modifications in the comments. How about attached? -- With Regards, Amit Kapila.
Re: Include schema-qualified names in publication error messages.
От:
Dilip Kumar <dilipbalaut@gmail.com>
Дата:
On Thu, May 7, 2026 at 3:38 PM Amit Kapila wrote: > > On Thu, May 7, 2026 at 3:03 PM shveta malik wrote: > > > > On Thu, May 7, 2026 at 11:30 AM vignesh C wrote: > > > > > > On Wed, 6 May 2026 at 09:27, Amit Kapila wrote: > > > > > > > > On Tue, May 5, 2026 at 5:56 PM Euler Taveira wrote: > > > > > > > > > > On Tue, May 5, 2026, at 7:42 AM, Amit Kapila wrote: > > > > > > On Tue, May 5, 2026 at 4:02 PM Dilip Kumar wrote: > > > > > >> > > > > > >> > Now, we also need to decide whether to backpatch the relevant change > > > > > >> > to back-branches. It seems we didn't get the bug-report yet but > > > > > >> > clearly what we do currently is not correct. So, we should ideally > > > > > >> > backpatch it and in the back branches we don't need to expose it. > > > > > >> > OTOH, as it is reported and is not a big issue, so we can keep this as > > > > > >> > a HEAD only change as well. If we want to keep this as a HEAD only > > > > > >> > change then shall we wait for PG20 branch to open or go for current > > > > > >> > HEAD itself? What do you and or others think on this matter? > > > > > >> > > > > > >> I think we should apply in PG19. Although back-patching isn't > > > > > >> critical, since we already have an opportunity to fix it in PG19, why > > > > > >> not push it early? > > > > > >> > > > > > > > > > > > > I also think we should push it for PG19 especially because the EXCEPT > > > > > > feature increased the usage of relation names without schema-name in > > > > > > error messages. However, as we are past feature freeze, I wanted to > > > > > > know the opinion of others as well. > > > > > > > > > > > > > > > > -1 for backpatching. > > > > > > > > > > > > > Agreed. > > > > > > > > > These messages (without schema qualification) has been > > > > > like this since the beginning. The function was not introduced by fd366065e06a > > > > > and the proposed patch are changing existing messages as well. It is a good > > > > > idea to keep visible messages (WARNING, ERROR, FATAL, PANIC) consistent so as > > > > > not to break log analysis tools. > > > > > > > > > > I would say the target is v20. However, as Amit said, the change to the EXCEPT > > > > > clause message might be important, so I suggest changing it; I would leave the > > > > > other messages for the RMT to decide. > > > > > > > > > > > > > Okay, then we can split the patch into two, the first patch to make > > > > the required changes only for EXCEPT, and the second one for the > > > > remaining pre-existing messages. We can push the first patch in HEAD > > > > and wait for some more opinions on the second one. > > > > > > The updated patch has the changes to split it. > > > > > > > Thanks Vignesh. > > > > +/* > > + * get_qualified_relname > > + * Get a palloc'd string containing the schema-qualified name of the relation > > + * for the given namespace ID and relation name. > > + */ > > +char * > > +get_qualified_relname(Oid nspid, char *relname) > > > > I think, instead of get_qualified_relname(), we should have generic > > get_qualified_objname(), so that others can also use it. +1 > > That makes sense. I have changed that in the attached and made slight > modifications in the comments. How about attached? Attached patch LGTM. -- Regards, Dilip Kumar Google
Re: Include schema-qualified names in publication error messages.
От:
shveta malik <shveta.malik@gmail.com>
Дата:
On Thu, May 7, 2026 at 3:38 PM Amit Kapila wrote: > > On Thu, May 7, 2026 at 3:03 PM shveta malik wrote: > > > > On Thu, May 7, 2026 at 11:30 AM vignesh C wrote: > > > > > > On Wed, 6 May 2026 at 09:27, Amit Kapila wrote: > > > > > > > > On Tue, May 5, 2026 at 5:56 PM Euler Taveira wrote: > > > > > > > > > > On Tue, May 5, 2026, at 7:42 AM, Amit Kapila wrote: > > > > > > On Tue, May 5, 2026 at 4:02 PM Dilip Kumar wrote: > > > > > >> > > > > > >> > Now, we also need to decide whether to backpatch the relevant change > > > > > >> > to back-branches. It seems we didn't get the bug-report yet but > > > > > >> > clearly what we do currently is not correct. So, we should ideally > > > > > >> > backpatch it and in the back branches we don't need to expose it. > > > > > >> > OTOH, as it is reported and is not a big issue, so we can keep this as > > > > > >> > a HEAD only change as well. If we want to keep this as a HEAD only > > > > > >> > change then shall we wait for PG20 branch to open or go for current > > > > > >> > HEAD itself? What do you and or others think on this matter? > > > > > >> > > > > > >> I think we should apply in PG19. Although back-patching isn't > > > > > >> critical, since we already have an opportunity to fix it in PG19, why > > > > > >> not push it early? > > > > > >> > > > > > > > > > > > > I also think we should push it for PG19 especially because the EXCEPT > > > > > > feature increased the usage of relation names without schema-name in > > > > > > error messages. However, as we are past feature freeze, I wanted to > > > > > > know the opinion of others as well. > > > > > > > > > > > > > > > > -1 for backpatching. > > > > > > > > > > > > > Agreed. > > > > > > > > > These messages (without schema qualification) has been > > > > > like this since the beginning. The function was not introduced by fd366065e06a > > > > > and the proposed patch are changing existing messages as well. It is a good > > > > > idea to keep visible messages (WARNING, ERROR, FATAL, PANIC) consistent so as > > > > > not to break log analysis tools. > > > > > > > > > > I would say the target is v20. However, as Amit said, the change to the EXCEPT > > > > > clause message might be important, so I suggest changing it; I would leave the > > > > > other messages for the RMT to decide. > > > > > > > > > > > > > Okay, then we can split the patch into two, the first patch to make > > > > the required changes only for EXCEPT, and the second one for the > > > > remaining pre-existing messages. We can push the first patch in HEAD > > > > and wait for some more opinions on the second one. > > > > > > The updated patch has the changes to split it. > > > > > > > Thanks Vignesh. > > > > +/* > > + * get_qualified_relname > > + * Get a palloc'd string containing the schema-qualified name of the relation > > + * for the given namespace ID and relation name. > > + */ > > +char * > > +get_qualified_relname(Oid nspid, char *relname) > > > > I think, instead of get_qualified_relname(), we should have generic > > get_qualified_objname(), so that others can also use it. > > > > That makes sense. I have changed that in the attached and made slight > modifications in the comments. How about attached? > LGTM. Thanks Shveta
Re: Include schema-qualified names in publication error messages.
От:
"Euler Taveira" <euler@eulerto.com>
Дата:
On Thu, May 7, 2026, at 7:07 AM, Amit Kapila wrote: > > That makes sense. I have changed that in the attached and made slight > modifications in the comments. How about attached? > One minor suggestion is to rename get_relation_qualified_name to get_qualified_relation_name. If we want to reuse this new function get_relation_qualified_name into other places, shouldn't we move this function to lsyscache.c? There are places like matview.c that could benefit from this new function. -- Euler Taveira EDB https://www.enterprisedb.com/
Re: Include schema-qualified names in publication error messages.
От:
"Euler Taveira" <euler@eulerto.com>
Дата:
On Thu, May 7, 2026, at 3:00 AM, vignesh C wrote:
>
> * v5-0001-Include-schema-qualified-names-in-EXCEPT-clause-e.patch
> * v5-0002-Include-schema-qualified-names-in-non-EXCEPT-publ.patch
Regarding v5-0002:
check_publication_add_relation(PublicationRelInfo *pri)
{
Relation targetrel = pri->relation;
- const char *relname;
const char *errormsg;
if (pri->except)
- {
- relname = get_relation_qualified_name(targetrel);
errormsg = gettext_noop("cannot specify relation \"%s\" in the publication EXCEPT clause");
- }
else
- {
- relname = RelationGetRelationName(targetrel);
errormsg = gettext_noop("cannot add relation \"%s\" to publication");
- }
Why did you remove relname variable? In addition to reduce the patch size, you
avoid increasing the number of modifications if the function
get_relation_qualified_name is modified in the future.
--
Euler Taveira
EDB https://www.enterprisedb.com/
Re: Include schema-qualified names in publication error messages.
От:
Amit Kapila <amit.kapila16@gmail.com>
Дата:
On Thu, May 7, 2026 at 5:50 PM Euler Taveira wrote: > > On Thu, May 7, 2026, at 7:07 AM, Amit Kapila wrote: > > > > That makes sense. I have changed that in the attached and made slight > > modifications in the comments. How about attached? > > > > One minor suggestion is to rename get_relation_qualified_name to > get_qualified_relation_name. If we want to reuse this new function > get_relation_qualified_name into other places, shouldn't we move this function > to lsyscache.c? There are places like matview.c that could benefit from this new > function. > This suggestion sounds reasonable to me but I suggest instead moving this new function to rel.h as an inline function or into relcache.c as those are the places where we take functions with Relation as input. Additionally, we can name the function as RelationGetQualifiedRelationName(). -- With Regards, Amit Kapila.
Re: Include schema-qualified names in publication error messages.
От:
"Euler Taveira" <euler@eulerto.com>
Дата:
On Thu, May 7, 2026, at 9:36 AM, Amit Kapila wrote: > On Thu, May 7, 2026 at 5:50 PM Euler Taveira wrote: > > This suggestion sounds reasonable to me but I suggest instead moving > this new function to rel.h as an inline function or into relcache.c as > those are the places where we take functions with Relation as input. > Additionally, we can name the function as > RelationGetQualifiedRelationName(). > LGTM. -- Euler Taveira EDB https://www.enterprisedb.com/
Re: Include schema-qualified names in publication error messages.
On Thu, 7 May 2026 at 17:57, Euler Taveira wrote:
>
> On Thu, May 7, 2026, at 3:00 AM, vignesh C wrote:
> >
> > * v5-0001-Include-schema-qualified-names-in-EXCEPT-clause-e.patch
> > * v5-0002-Include-schema-qualified-names-in-non-EXCEPT-publ.patch
>
> Regarding v5-0002:
>
> check_publication_add_relation(PublicationRelInfo *pri)
> {
> Relation targetrel = pri->relation;
> - const char *relname;
> const char *errormsg;
>
> if (pri->except)
> - {
> - relname = get_relation_qualified_name(targetrel);
> errormsg = gettext_noop("cannot specify relation \"%s\" in the publication EXCEPT clause");
> - }
> else
> - {
> - relname = RelationGetRelationName(targetrel);
> errormsg = gettext_noop("cannot add relation \"%s\" to publication");
> - }
>
> Why did you remove relname variable? In addition to reduce the patch size, you
> avoid increasing the number of modifications if the function
> get_relation_qualified_name is modified in the future.
I initially wanted to keep the changes aligned with the implementation
in HEAD. However, now that the patch has been committed, I agree with
retaining the variable. The attached patch includes the corresponding
changes.
Regards,
Vignesh
Re: Include schema-qualified names in publication error messages.
От:
Amit Kapila <amit.kapila16@gmail.com>
Дата:
On Thu, May 7, 2026 at 6:07 PM Euler Taveira wrote: > > On Thu, May 7, 2026, at 9:36 AM, Amit Kapila wrote: > > On Thu, May 7, 2026 at 5:50 PM Euler Taveira wrote: > > > > This suggestion sounds reasonable to me but I suggest instead moving > > this new function to rel.h as an inline function or into relcache.c as > > those are the places where we take functions with Relation as input. > > Additionally, we can name the function as > > RelationGetQualifiedRelationName(). > > > > LGTM. > Thanks, I've pushed the patch after making required changes. -- With Regards, Amit Kapila.
Re: Include schema-qualified names in publication error messages.
От:
Peter Smith <smithpb2250@gmail.com>
Дата:
On Thu, May 7, 2026 at 4:00 PM vignesh C wrote:
>
...
> > Okay, then we can split the patch into two, the first patch to make
> > the required changes only for EXCEPT, and the second one for the
> > remaining pre-existing messages. We can push the first patch in HEAD
> > and wait for some more opinions on the second one.
>
Hi Vignesh.
The patch had previously been split for EXCEPT and non-EXCEPT changes.
The 0001 patch was already pushed a while ago for PG19. I think now
that 0002 patch can be revisited for PG20.
======
IMO, the logical replication messages should consistently always give
fully qualified relation names in the error messages. The relation
named in the message can sometimes be ambiguous when not schema
qualified.
I saw some previous comment from Euler [1] saying we should refrain
from changing existing messages, but IMO here we are not rewording
message text for the sake of it; I think rather it is fixing the
values substituted to the *existing* messages to improve the clarity,
and at the same time making all the logical replication logs more
consistent. But, perhaps I misunderstood Euler's comment: if it was -1
referring only to backpatching then I agree.
Anyway, I looked again at the old v5-0002 patch. I found it is only
addressing the issue schema-qualification for
check_publication_add_relation. Actually, I think that is just a very
small part of something far bigger. e.g. There are many more places in
logical replication related code where fully qualified names could be
used.
Also, sometimes the log message is already schema-qualified, but is
not yet using the new "common" function designed for that purpose.
Below are dozens of examples that I found by searching the pub/sub
code for quoted relations/sequences/tables. Maybe you can find even
more.
======
Relations:
------
src/backend/commands/publicationcmds.c
TransformPubWhereClauses: errmsg("cannot use publication WHERE clause
for relation \"%s\"",
CheckPubRelationColumnList: errmsg("cannot use column list for
relation \"%s.%s\" in publication \"%s\"",
CheckPubRelationColumnList: errmsg("cannot use column list for
relation \"%s.%s\" in publication \"%s\"",
PublicationDropTables: errmsg("relation \"%s\" is not part of the publication",
------
src/backend/catalog/objectaddress.c
get_object_address_attribute: errmsg("column \"%s\" of relation \"%s\"
does not exist",
get_object_address_attrdef: errmsg("default value for column \"%s\" of
relation \"%s\" does not exist",
get_object_address_publication_rel: errmsg("publication relation
\"%s\" in publication \"%s\" does not exist",
------
src/backend/catalog/pg_publication.c
check_publication_add_relation: errormsg = gettext_noop("cannot add
relation \"%s\" to publication");
publication_add_relation: errmsg("relation \"%s\" is already member of
publication \"%s\"",
pub_collist_validate: errmsg("column \"%s\" of relation \"%s\" does not exist",
------
src/backend/catalog/pg_subscription.c
RemoveSubscriptionRel: errdetail("Table synchronization for relation
\"%s\" is in progress and is in state \"%c\".",
======
Sequences:
------
src/backend/commands/subscriptioncmds.c
AlterSubscription_refresh: errmsg_internal("sequence \"%s.%s\" removed
from subscription \"%s\"",
AlterSubscription_refresh_seq: errmsg_internal("sequence \"%s.%s\" of
subscription \"%s\" set to INIT state",
------
src/backend/replication/logical/sequencesync.c
copy_sequences: "logical replication synchronization for subscription
\"%s\", sequence \"%s.%s\" has finished",
======
Tables:
------
src/backend/commands/tablecmds.c
ATPrepChangePersistence: errmsg("cannot change table \"%s\" to
unlogged because it is part of a publication",
ATExecAttachPartition: errmsg_plural("cannot attach table \"%s\" as
partition because it is referenced in publication %s EXCEPT clause",
ATExecAttachPartition: cannot attach table \"%s\" as partition
because it is referenced in publications %s EXCEPT clause",
------
src/backend/commands/publicationcmds.c
AlterPublicationOptions: errdetail("The publication contains a WHERE
clause for partitioned table \"%s\", which is not allowed when \"%s\"
is false.",
AlterPublicationOptions: errdetail("The publication contains a column
list for partitioned table \"%s\", which is not allowed when \"%s\" is
false.",
OpenTableList: errmsg("conflicting or redundant WHERE clauses for table \"%s\"",
OpenTableList: errmsg("conflicting or redundant column lists for table \"%s\"",
OpenTableList: errmsg("conflicting or redundant WHERE clauses for table \"%s\"",
OpenTableList: errmsg("conflicting or redundant column lists for table \"%s\"",
------
src/backend/executor/execReplication.c
CheckCmdReplicaIdentity: errmsg("cannot update table \"%s\""
CheckCmdReplicaIdentity: errmsg("cannot update table \"%s\"",
CheckCmdReplicaIdentity: errmsg("cannot update table \"%s\"",
CheckCmdReplicaIdentity: errmsg("cannot delete from table \"%s\"",
CheckCmdReplicaIdentity: errmsg("cannot delete from table \"%s\"",
CheckCmdReplicaIdentity: errmsg("cannot delete from table \"%s\"",
- errmsg("cannot update table \"%s\" because it does not have a
replica identity and publishes updates",
- errmsg("cannot delete from table \"%s\" because it does not have a
replica identity and publishes deletes",
------
src/backend/replication/logical/syncutils.c
FinishSyncWorker: errmsg("logical replication table synchronization
worker for subscription \"%s\", table \"%s\" has finished",
------
src/backend/replication/logical/worker.c
InitializeLogRepWorker: errmsg("logical replication table
synchronization worker for subscription \"%s\", table \"%s\" has
started",
//////
Regarding the code of v5-0002 patch, my comments are below:
1.
Wasn't the newly pushed function called
'RelationGetQualifiedRelationName'. Maybe the name was changed after
some time after your v5* patches?
~~~
2.
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg(errormsg, relname),
+ errmsg(errormsg, get_relation_qualified_name(targetrel)),
errdetail("This operation is not supported for individual partitions.")));
That "get_relation_qualified_name(targetrel)" is repeated many times.
IMO the code would be neater to just assign the name up-front to a
variable.
======
[1] https://www.postgresql.org/message-id/d0979f9c-10a3-4983-8a41-7014135d02f9%40app.fastmail.com
Kind Regards,
Peter Smith.
Fujitsu Australia
Re: Include schema-qualified names in publication error messages.
On Wed, 9 Sept 2026 at 14:15, vignesh C wrote:
>
> On Wed, 27 May 2026 at 11:50, Peter Smith wrote:
> >
> > The patch had previously been split for EXCEPT and non-EXCEPT changes.
> >
> > The 0001 patch was already pushed a while ago for PG19. I think now
> > that 0002 patch can be revisited for PG20.
>
> Attached v7 version patch has the changes for the same. This patch is
> the same as [1], reattaching here so it is easier for review.
v7 no longer applies cleanly to HEAD because commit 926627bf902
("Don't quote the relation name twice in EXCEPT clause errors.")
changed the same lines in check_publication_add_relation(). The
attached v8 builds the name once in this form and uses it for the
errors. While rebasing, I also had to update one test. For a temporary
table, the schema is pg_temp_N, where N depends on the backend running
the test. So the error message can vary between runs, for example:
ERROR: cannot add relation "pg_temp_14.testpub_temptbl" to publication
For this case, the regression test now uses \set VERBOSITY sqlstate
and checks only the SQLSTATE, similar to create_function_c.sql and
arrays.sql for other unstable messages.
Regards,
Vignesh
Re: Include schema-qualified names in publication error messages (generalised to all of LR).
Hi hackers,
Here is my more generic solution.
It generalises the EXCEPT-clause fix (a49b9cfd) and Vignesh's v8 for
check_publication_add_relation() to the rest of the logical
replication code.
~
The same pattern -- wrap a relation's namespace+name lookup before
putting it in a message -- is currently done ad hoc across LR code, in
three different ways:
1. Bare RelationGetRelationName()/get_rel_name(). Ambiguous whenever
the same name exists in more than one schema, which is routine with
per-schema publications.
2. Manual get_namespace_name()+get_rel_name() concatenation.
3. get_qualified_objname(), which quotes via
quote_qualified_identifier() and so double-quotes when put into a
message that already supplies its own quotes. Not hypothetical -- this
is what 926627bf902 ("Don't quote the relation name twice in EXCEPT
clause errors") had to fix.
That's more than a dozen call sites across pg_publication.c,
pg_subscription.c, publicationcmds.c, subscriptioncmds.c,
execReplication.c, conflict.c, relation.c, sequencesync.c,
tablesync.c, worker.c, pgoutput.c, and others.
~
PSA 0001 and 0002.
0001 adds three helpers to relcache.c -- MsgQualifiedRelName(),
...ByRel(), ...ByRelId() -- returning an unquoted "schema.relation"
string for %s substitution. Per the error style guide, a function that
already quotes its own output should not be wrapped in more quotes
[1], so these deliberately don't quote. All LR call sites that build a
qualified name for a message are converted to use them, including
index names, which weren't qualified anywhere before this.
0002 removes get_qualified_objname() once 0001 leaves it with a single
remaining caller, inlining it into generate_qualified_relation_name()
in ruleutils.c.
~
Open question: for a temporary table, should the schema be displayed
as "pg_temp" or "pg_temp_N"? The attached keeps "pg_temp_N", which is
the current status quo. Anyway, after 0001 this is a one-line change
in MsgQualifiedRelNameByRel()/...ByRelId() if the consensus is
otherwise.
~
More details can be found in the patch commit messages.
This is not a competing patch to Vignesh's v8 -- it's the same fix
carried through to everywhere else it already applies. The alternative
is fixing check_publication_add_relation() now and having this same
discussion again next time it turns up somewhere else in LR, which it
has, repeatedly.
======
[1] https://www.postgresql.org/docs/current/error-style-guide.html#ERROR-STYLE-GUIDE-QUOTES
Kind Regards,
Peter Smith.
Fujitsu Australia
RE: Include schema-qualified names in publication error messages (generalised to all of LR).
От:
"Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Дата:
Hi Peter, +1 the basic idea. But I have a worry that translations for around 20 statements will be invalidated because "%s.%s" will be replaced to "%s", which needs additional work for translators (even the outcome is not changed). Not sure the conversion wins the cost, or is it acceptable for HEAD? Anyway, I grepped source codes under the logical/ and some codes under the commands/. I found single RelationGetRelationName()/get_rel_name() call are retained in some places, but seems OK. IIUC, below four types are still retained. * replication protocol message. We have been sending them separately, and no reasons to combine. * table/sequence mactching between publication and subscription. We are now passing to queries them. * ACL checks. It's not schema-qualified even from other places, so it's OK not to do for now. * Subscription relkind checks. The function accepts the namespace and relation name separately, because the remote name can be specified. It's more natural to keep current style. > Open question: for a temporary table, should the schema be displayed > as "pg_temp" or "pg_temp_N"? The attached keeps "pg_temp_N", which is > the current status quo. Anyway, after 0001 this is a one-line change > in MsgQualifiedRelNameByRel()/...ByRelId() if the consensus is > otherwise. IIUC, for the current region, the pg_temp schema can be reported only backend processes, right? If so I prefer without suffic, pg_temp. pg_temp_xxx is usable if other processes report the temp schema, maybe like autovacuum worker. Best regards, Hayato Kuroda FUJITSU LIMITED
Re: Include schema-qualified names in publication error messages (generalised to all of LR).
От:
Peter Smith <smithpb2250@gmail.com>
Дата:
On Fri, Oct 16, 2026 at 7:39 PM Hayato Kuroda (Fujitsu) wrote: > > Hi Peter, > > +1 the basic idea. But I have a worry that translations for around 20 statements > will be invalidated because "%s.%s" will be replaced to "%s", which needs > additional work for translators (even the outcome is not changed). > Not sure the conversion wins the cost, or is it acceptable for HEAD? > Hi Kuroda-San, AFAIK, translator churn is only really expensive near string freeze, when translators are doing a final push against a deadline. Right now master has been open for v20 for a while and won't see a string freeze for a good while yet, so changing 20 strings in the first months of a devel cycle is about as cheap as it gets. gettext marks a changed msgid as "fuzzy" rather than discarding the existing translation, so a translator is only re-approving a one-token change to wording they've already translated, not starting from scratch. IIUC, that should take only a few seconds per message - not really a huge burden. ====== Kind Regards, Peter Smith. Fujitsu Australia