On 2015-06-29 AM 11:36, Amit Langote wrote:
> Hi,
> 
> How about the attached that adjusts errorcode for the error related to
> checking the flag bgw_flags in BackgroundWorkerInitializeConnection*()
> functions so that it matches the treatment in SanityCheckBackgroundWorker()?
> 
> s/ERRCODE_PROGRAM_LIMIT_EXCEEDED/ERRCODE_INVALID_PARAMETER_VALUE/g
> 
> There is already a "/* XXX is this the right errcode? */" there.
> 

Oops, a wrong thing got attached.

Please find correct one attached this time.

Thanks,
Amit
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index df8037b..d835775 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -5333,10 +5333,9 @@ BackgroundWorkerInitializeConnection(char *dbname, char *username)
 {
 	BackgroundWorker *worker = MyBgworkerEntry;
 
-	/* XXX is this the right errcode? */
 	if (!(worker->bgw_flags & BGWORKER_BACKEND_DATABASE_CONNECTION))
 		ereport(FATAL,
-				(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
+				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 				 errmsg("database connection requirement not indicated during registration")));
 
 	InitPostgres(dbname, InvalidOid, username, InvalidOid, NULL);
@@ -5356,10 +5355,9 @@ BackgroundWorkerInitializeConnectionByOid(Oid dboid, Oid useroid)
 {
 	BackgroundWorker *worker = MyBgworkerEntry;
 
-	/* XXX is this the right errcode? */
 	if (!(worker->bgw_flags & BGWORKER_BACKEND_DATABASE_CONNECTION))
 		ereport(FATAL,
-				(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
+				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 				 errmsg("database connection requirement not indicated during registration")));
 
 	InitPostgres(NULL, dboid, NULL, useroid, NULL);
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to