Index: Singular/iparith.cc
===================================================================
--- Singular/iparith.cc	(revision 4dfb227a84690906265e2bcf49abffa98444b04b)
+++ Singular/iparith.cc	(revision 19ad27804d6e9c1c16eb3b3f560ad543ea06b922)
@@ -2195,4 +2195,45 @@
 static BOOLEAN jjHILBERT2(leftv res, leftv u, leftv v)
 {
+#ifdef HAVE_RINGS
+  if (rField_is_Ring_Z(currRing))
+  {
+    ring origR = currRing;
+    ring tempR = rCopy(origR);
+    tempR->ringtype = 0; tempR->ch = 0;
+    rComplete(tempR);
+    ideal uid = (ideal)u->Data();
+    rChangeCurrRing(tempR);
+    ideal uu = idrCopyR(uid, origR, currRing);
+    sleftv uuAsLeftv; memset(&uuAsLeftv, 0, sizeof(uuAsLeftv));
+    uuAsLeftv.rtyp = IDEAL_CMD;
+    uuAsLeftv.data = uu; uuAsLeftv.next = NULL;
+    if (hasFlag(u, FLAG_STD)) setFlag(&uuAsLeftv,FLAG_STD);
+    assumeStdFlag(&uuAsLeftv);
+    Print("// NOTE: computation of Hilbert series etc. is being\n");
+    Print("//       performed for generic fibre, that is, over Q\n");
+    intvec *module_w=(intvec*)atGet(&uuAsLeftv,"isHomog",INTVEC_CMD);
+    intvec *iv=hFirstSeries(uu,module_w,currQuotient);
+    int returnWithTrue = 1;
+    switch((int)(long)v->Data())
+    {
+      case 1:
+        res->data=(void *)iv;
+        returnWithTrue = 0;
+      case 2:
+        res->data=(void *)hSecondSeries(iv);
+        delete iv;
+        returnWithTrue = 0;
+    }
+    if (returnWithTrue)
+    {
+      WerrorS(feNotImplemented);
+      delete iv;
+    }
+    idDelete(&uu);
+    rChangeCurrRing(origR);
+    rDelete(tempR);
+    if (returnWithTrue) return TRUE; else return FALSE;
+  }
+#endif
   assumeStdFlag(u);
   intvec *module_w=(intvec*)atGet(u,"isHomog",INTVEC_CMD);
@@ -3654,5 +3695,5 @@
       return FALSE;
     }
-    rChangeCurrRing(tempR); rComplete(tempR);
+    rChangeCurrRing(tempR);
     ideal vv = idrCopyR(vid, origR, currRing);
     /* drop degree zero generator from vv (if any) */
@@ -3824,4 +3865,30 @@
 static BOOLEAN jjHILBERT(leftv res, leftv v)
 {
+#ifdef HAVE_RINGS
+  if (rField_is_Ring_Z(currRing))
+  {
+    ring origR = currRing;
+    ring tempR = rCopy(origR);
+    tempR->ringtype = 0; tempR->ch = 0;
+    rComplete(tempR);
+    ideal vid = (ideal)v->Data();
+    rChangeCurrRing(tempR);
+    ideal vv = idrCopyR(vid, origR, currRing);
+    sleftv vvAsLeftv; memset(&vvAsLeftv, 0, sizeof(vvAsLeftv));
+    vvAsLeftv.rtyp = IDEAL_CMD;
+    vvAsLeftv.data = vv; vvAsLeftv.next = NULL;
+    if (hasFlag(v, FLAG_STD)) setFlag(&vvAsLeftv,FLAG_STD);
+    assumeStdFlag(&vvAsLeftv);
+    Print("// NOTE: computation of Hilbert series etc. is being\n");
+    Print("//       performed for generic fibre, that is, over Q\n");
+    intvec *module_w=(intvec*)atGet(&vvAsLeftv,"isHomog",INTVEC_CMD);
+    //scHilbertPoly(vv,currQuotient);
+    hLookSeries(vv,module_w,currQuotient);
+    idDelete(&vv);
+    rChangeCurrRing(origR);
+    rDelete(tempR);
+    return FALSE;
+  }
+#endif
   assumeStdFlag(v);
   intvec *module_w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
@@ -3832,4 +3899,11 @@
 static BOOLEAN jjHILBERT_IV(leftv res, leftv v)
 {
+#ifdef HAVE_RINGS
+  if (rField_is_Ring_Z(currRing))
+  {
+    Print("// NOTE: computation of Hilbert series etc. is being\n");
+    Print("//       performed for generic fibre, that is, over Q\n");
+  }
+#endif
   res->data=(void *)hSecondSeries((intvec *)v->Data());
   return FALSE;
@@ -5383,13 +5457,54 @@
 static BOOLEAN jjHILBERT3(leftv res, leftv u, leftv v, leftv w)
 {
+  intvec *wdegree=(intvec*)w->Data();
+  if (wdegree->length()!=pVariables)
+  {
+    Werror("weight vector must have size %d, not %d",
+           pVariables,wdegree->length());
+    return TRUE;
+  }
+#ifdef HAVE_RINGS
+  if (rField_is_Ring_Z(currRing))
+  {
+    ring origR = currRing;
+    ring tempR = rCopy(origR);
+    tempR->ringtype = 0; tempR->ch = 0;
+    rComplete(tempR);
+    ideal uid = (ideal)u->Data();
+    rChangeCurrRing(tempR);
+    ideal uu = idrCopyR(uid, origR, currRing);
+    sleftv uuAsLeftv; memset(&uuAsLeftv, 0, sizeof(uuAsLeftv));
+    uuAsLeftv.rtyp = IDEAL_CMD;
+    uuAsLeftv.data = uu; uuAsLeftv.next = NULL;
+    if (hasFlag(u, FLAG_STD)) setFlag(&uuAsLeftv,FLAG_STD);
+    assumeStdFlag(&uuAsLeftv);
+    Print("// NOTE: computation of Hilbert series etc. is being\n");
+    Print("//       performed for generic fibre, that is, over Q\n");
+    intvec *module_w=(intvec*)atGet(&uuAsLeftv,"isHomog",INTVEC_CMD);
+    intvec *iv=hFirstSeries(uu,module_w,currQuotient,wdegree);
+    int returnWithTrue = 1;
+    switch((int)(long)v->Data())
+    {
+      case 1:
+        res->data=(void *)iv;
+        returnWithTrue = 0;
+      case 2:
+        res->data=(void *)hSecondSeries(iv);
+        delete iv;
+        returnWithTrue = 0;
+    }
+    if (returnWithTrue)
+    {
+      WerrorS(feNotImplemented);
+      delete iv;
+    }
+    idDelete(&uu);
+    rChangeCurrRing(origR);
+    rDelete(tempR);
+    if (returnWithTrue) return TRUE; else return FALSE;
+  }
+#endif
   assumeStdFlag(u);
   intvec *module_w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
-  intvec *wdegree=(intvec*)w->Data();
-  if (wdegree->length()!=pVariables)
-  {
-    Werror("weight vector must have size %d, not %d",
-           pVariables,wdegree->length());
-    return TRUE;
-  }
   intvec *iv=hFirstSeries((ideal)u->Data(),module_w,currQuotient,wdegree);
   switch((int)(long)v->Data())
Index: Singular/table.h
===================================================================
--- Singular/table.h	(revision 4dfb227a84690906265e2bcf49abffa98444b04b)
+++ Singular/table.h	(revision 19ad27804d6e9c1c16eb3b3f560ad543ea06b922)
@@ -116,7 +116,7 @@
 ,{D(jjHIGHCORNER), HIGHCORNER_CMD,  POLY_CMD,       IDEAL_CMD     , NO_PLURAL |ALLOW_RING}
 ,{D(jjHIGHCORNER_M), HIGHCORNER_CMD,VECTOR_CMD,     MODUL_CMD     , NO_PLURAL |ALLOW_RING}
-,{D(jjHILBERT),    HILBERT_CMD,     NONE,           IDEAL_CMD     , NO_PLURAL |NO_RING}
-,{D(jjHILBERT),    HILBERT_CMD,     NONE,           MODUL_CMD     , NO_PLURAL |NO_RING}
-,{D(jjHILBERT_IV), HILBERT_CMD,     INTVEC_CMD,     INTVEC_CMD    , NO_PLURAL |NO_RING}
+,{D(jjHILBERT),    HILBERT_CMD,     NONE,           IDEAL_CMD     , NO_PLURAL |ALLOW_RING | NO_ZERODIVISOR}
+,{D(jjHILBERT),    HILBERT_CMD,     NONE,           MODUL_CMD     , NO_PLURAL |ALLOW_RING | NO_ZERODIVISOR}
+,{D(jjHILBERT_IV), HILBERT_CMD,     INTVEC_CMD,     INTVEC_CMD    , NO_PLURAL |ALLOW_RING | NO_ZERODIVISOR}
 ,{D(jjHOMOG1),     HOMOG_CMD,       INT_CMD,        IDEAL_CMD     , ALLOW_PLURAL |ALLOW_RING}
 ,{D(jjHOMOG1),     HOMOG_CMD,       INT_CMD,        MODUL_CMD     , ALLOW_PLURAL |ALLOW_RING}
@@ -544,6 +544,6 @@
 ,{  jjWRONG2 ,    GCD_CMD,        POLY_CMD,       POLY_CMD,   POLY_CMD, NO_PLURAL |NO_RING}
 #endif
-,{D(jjHILBERT2),  HILBERT_CMD,    INTVEC_CMD,     IDEAL_CMD,  INT_CMD, NO_PLURAL |NO_RING}
-,{D(jjHILBERT2),  HILBERT_CMD,    INTVEC_CMD,     MODUL_CMD,  INT_CMD, NO_PLURAL |NO_RING}
+,{D(jjHILBERT2),  HILBERT_CMD,    INTVEC_CMD,     IDEAL_CMD,  INT_CMD, NO_PLURAL | ALLOW_RING | NO_ZERODIVISOR}
+,{D(jjHILBERT2),  HILBERT_CMD,    INTVEC_CMD,     MODUL_CMD,  INT_CMD, NO_PLURAL | ALLOW_RING | NO_ZERODIVISOR}
 ,{D(jjHOMOG1_W),  HOMOG_CMD,      INT_CMD,        IDEAL_CMD,  INTVEC_CMD, ALLOW_PLURAL |ALLOW_RING}
 ,{D(jjHOMOG1_W),  HOMOG_CMD,      INT_CMD,        MODUL_CMD,   INTVEC_CMD, ALLOW_PLURAL |ALLOW_RING}
@@ -682,6 +682,6 @@
 ,{D(jjFIND3),          FIND_CMD,   INT_CMD,    STRING_CMD, STRING_CMD, INT_CMD, ALLOW_PLURAL |ALLOW_RING}
 ,{D(jjFWALK3),         FWALK_CMD,  IDEAL_CMD,  RING_CMD,   DEF_CMD,    INT_CMD, NO_PLURAL |ALLOW_RING}
-,{D(jjHILBERT3),       HILBERT_CMD,INTVEC_CMD, IDEAL_CMD,  INT_CMD,    INTVEC_CMD, NO_PLURAL |NO_RING}
-,{D(jjHILBERT3),       HILBERT_CMD,INTVEC_CMD, MODUL_CMD,  INT_CMD,    INTVEC_CMD, NO_PLURAL |NO_RING}
+,{D(jjHILBERT3),       HILBERT_CMD,INTVEC_CMD, IDEAL_CMD,  INT_CMD,    INTVEC_CMD, NO_PLURAL | ALLOW_RING | NO_ZERODIVISOR}
+,{D(jjHILBERT3),       HILBERT_CMD,INTVEC_CMD, MODUL_CMD,  INT_CMD,    INTVEC_CMD, NO_PLURAL | ALLOW_RING | NO_ZERODIVISOR}
 ,{D(jjHOMOG_P_W),      HOMOG_CMD,  POLY_CMD,   POLY_CMD,   POLY_CMD,   INTVEC_CMD, ALLOW_PLURAL |ALLOW_RING}
 ,{D(jjHOMOG_P_W),      HOMOG_CMD,  VECTOR_CMD, VECTOR_CMD, POLY_CMD,   INTVEC_CMD, ALLOW_PLURAL |ALLOW_RING}
