Re: Logical Replication - detail message with names of missing columns
От | Alvaro Herrera |
---|---|
Тема | Re: Logical Replication - detail message with names of missing columns |
Дата | |
Msg-id | 20200908144919.GA13287@alvherre.pgsql обсуждение исходный текст |
Ответ на | Re: Logical Replication - detail message with names of missing columns (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>) |
Ответы |
Re: Logical Replication - detail message with names of missing columns
|
Список | pgsql-hackers |
On 2020-Sep-08, Bharath Rupireddy wrote: > + /* Find the remote attributes that are missing in the local relation. */ > + for (i = 0; i < remoterel->natts; i++) > + { > + if (!bms_is_member(i, localattnums)) > + { > + if (missingatts->len == 0) > + { > + appendStringInfoChar(missingatts, '"'); > + appendStringInfoString(missingatts, remoterel->attnames[i]); > + } > + else if (missingatts->len > 0) > + { > + appendStringInfoChar(missingatts, ','); > + appendStringInfoChar(missingatts, '"'); > + appendStringInfo(missingatts, "%s", remoterel->attnames[i]); > + } > + > + appendStringInfoChar(missingatts, '"'); > + } This looks a bit fiddly. Would it be less cumbersome to use quote_identifier here instead? > ereport(ERROR, > (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), > errmsg("logical replication target relation \"%s.%s\" is missing " > - "some replicated columns", > - remoterel->nspname, remoterel->relname))); > + "replicated columns:%s", > + remoterel->nspname, remoterel->relname, > + missingatts.data))); Please do use errmsg_plural -- have the new function return the number of missing columns. Should be pretty straightforward. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
В списке pgsql-hackers по дате отправления: