--- a/OmniDB/OmniDB_app/include/Spartacus/Database.py
+++ b/OmniDB/OmniDB_app/include/Spartacus/Database.py
@@ -1859,6 +1859,16 @@ class PostgreSQL(Generic):
             if not v_keep:
                 self.Close()
 
+    def __getstate__(self):
+        state = self.__dict__.copy()
+        # don't pickle 'v_special'
+        del state["v_special"]
+        return state
+
+    def __setstate__(self, state):
+        self.__dict__.update(state)
+        # add 'v_special' back since it doesn't exist in the pickle
+        self.v_special = PGSpecial()
 
 '''
 ------------------------------------------------------------------------
