]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Department of second thoughts: probably still need an IsTransactionState
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 27 Apr 2003 18:01:46 +0000 (18:01 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 27 Apr 2003 18:01:46 +0000 (18:01 +0000)
test in there...

src/backend/utils/mb/mbutils.c

index a39dad6c42dfaa310fb8122b14f83898c684fd9f..fe9829a8cf2cd8aa1d69885e8a8a9773b4af6ec6 100644 (file)
@@ -4,7 +4,7 @@
  * (currently mule internal code (mic) is used)
  * Tatsuo Ishii
  *
- * $Header: /cvsroot/pgsql/src/backend/utils/mb/mbutils.c,v 1.40 2003/04/27 17:31:25 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/mb/mbutils.c,v 1.41 2003/04/27 18:01:46 tgl Exp $
  */
 #include "postgres.h"
 
@@ -106,6 +106,17 @@ SetClientEncoding(int encoding, bool doit)
                return 0;
        }
 
+       /*
+        * If we're not inside a transaction then we can't do catalog lookups,
+        * so fail.  After backend startup, this could only happen if we
+        * are re-reading postgresql.conf due to SIGHUP --- so basically this
+        * just constrains the ability to change client_encoding on the fly
+        * from postgresql.conf.  Which would probably be a stupid thing to do
+        * anyway.
+        */
+       if (!IsTransactionState())
+               return -1;
+
        /*
         * Look up the conversion functions.
         */