]> granicus.if.org Git - postgresql/commitdiff
Fix ALTER EXTENSION / SET SCHEMA
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 31 Oct 2012 13:48:41 +0000 (10:48 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 31 Oct 2012 13:48:41 +0000 (10:48 -0300)
In its original conception, it was leaving some objects into the old
schema, but without their proper pg_depend entries; this meant that the
old schema could be dropped, causing future pg_dump calls to fail on the
affected database.  This was originally reported by Jeff Frost as #6704;
there have been other complaints elsewhere that can probably be traced
to this bug.

To fix, be more consistent about altering a table's subsidiary objects
along the table itself; this requires some restructuring in how tables
are relocated when altering an extension -- hence the new
AlterTableNamespaceInternal routine which encapsulates it for both the
ALTER TABLE and the ALTER EXTENSION cases.

There was another bug lurking here, which was unmasked after fixing the
previous one: certain objects would be reached twice via the dependency
graph, and the second attempt to move them would cause the entire
operation to fail.  Per discussion, it seems the best fix for this is to
do more careful tracking of objects already moved: we now maintain a
list of moved objects, to avoid attempting to do it twice for the same
object.

Authors: Alvaro Herrera, Dimitri Fontaine
Reviewed by Tom Lane

src/backend/catalog/pg_constraint.c
src/backend/commands/alter.c
src/backend/commands/extension.c
src/backend/commands/tablecmds.c
src/backend/commands/typecmds.c
src/include/catalog/pg_constraint.h
src/include/commands/alter.h
src/include/commands/tablecmds.h
src/include/commands/typecmds.h

index 224859d76e76e6b577c4fca786033660698953ca..107a7809640a8f9c87d4177edb3e767d6e9c5af6 100644 (file)
@@ -678,7 +678,7 @@ RenameConstraintById(Oid conId, const char *newname)
  */
 void
 AlterConstraintNamespaces(Oid ownerId, Oid oldNspId,
-                                                 Oid newNspId, bool isType)
+                                                 Oid newNspId, bool isType, ObjectAddresses *objsMoved)
 {
        Relation        conRel;
        ScanKeyData key[1];
@@ -711,6 +711,14 @@ AlterConstraintNamespaces(Oid ownerId, Oid oldNspId,
        while (HeapTupleIsValid((tup = systable_getnext(scan))))
        {
                Form_pg_constraint conform = (Form_pg_constraint) GETSTRUCT(tup);
+               ObjectAddress   thisobj;
+
+               thisobj.classId = ConstraintRelationId;
+               thisobj.objectId = HeapTupleGetOid(tup);
+               thisobj.objectSubId = 0;
+
+               if (object_address_present(&thisobj, objsMoved))
+                       continue;
 
                if (conform->connamespace == oldNspId)
                {
@@ -728,6 +736,8 @@ AlterConstraintNamespaces(Oid ownerId, Oid oldNspId,
                         * changeDependencyFor().
                         */
                }
+
+               add_exact_object_address(&thisobj, objsMoved);
        }
 
        systable_endscan(scan);
index 4dd9927afbafaab2bec6c32597f134033fe1ee7c..e5bd3dd283d1c6e2577632a225ab4a7981927874 100644 (file)
@@ -241,7 +241,8 @@ ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt)
  * object doesn't have a schema.
  */
 Oid
-AlterObjectNamespace_oid(Oid classId, Oid objid, Oid nspOid)
+AlterObjectNamespace_oid(Oid classId, Oid objid, Oid nspOid,
+                                                ObjectAddresses *objsMoved)
 {
        Oid                     oldNspOid = InvalidOid;
        ObjectAddress dep;
@@ -255,20 +256,11 @@ AlterObjectNamespace_oid(Oid classId, Oid objid, Oid nspOid)
                case OCLASS_CLASS:
                        {
                                Relation        rel;
-                               Relation        classRel;
 
                                rel = relation_open(objid, AccessExclusiveLock);
                                oldNspOid = RelationGetNamespace(rel);
 
-                               classRel = heap_open(RelationRelationId, RowExclusiveLock);
-
-                               AlterRelationNamespaceInternal(classRel,
-                                                                                          objid,
-                                                                                          oldNspOid,
-                                                                                          nspOid,
-                                                                                          true);
-
-                               heap_close(classRel, RowExclusiveLock);
+                               AlterTableNamespaceInternal(rel, oldNspOid, nspOid, objsMoved);
 
                                relation_close(rel, NoLock);
                                break;
@@ -279,7 +271,7 @@ AlterObjectNamespace_oid(Oid classId, Oid objid, Oid nspOid)
                        break;
 
                case OCLASS_TYPE:
-                       oldNspOid = AlterTypeNamespace_oid(objid, nspOid);
+                       oldNspOid = AlterTypeNamespace_oid(objid, nspOid, objsMoved);
                        break;
 
                case OCLASS_COLLATION:
index 4f9ea2d12bcc69f3e47c88e0f320760042674e7a..29fcdd1b55d598a20c7b0541bbd6a8cbe95cb3c2 100644 (file)
@@ -2201,6 +2201,7 @@ AlterExtensionNamespace(List *names, const char *newschema)
        Relation        depRel;
        SysScanDesc depScan;
        HeapTuple       depTup;
+       ObjectAddresses *objsMoved;
 
        if (list_length(names) != 1)
                ereport(ERROR,
@@ -2275,6 +2276,8 @@ AlterExtensionNamespace(List *names, const char *newschema)
                                 errmsg("extension \"%s\" does not support SET SCHEMA",
                                                NameStr(extForm->extname))));
 
+       objsMoved = new_object_addresses();
+
        /*
         * Scan pg_depend to find objects that depend directly on the extension,
         * and alter each one's schema.
@@ -2314,9 +2317,11 @@ AlterExtensionNamespace(List *names, const char *newschema)
                if (dep.objectSubId != 0)               /* should not happen */
                        elog(ERROR, "extension should not have a sub-object dependency");
 
+               /* Relocate the object */
                dep_oldNspOid = AlterObjectNamespace_oid(dep.classId,
                                                                                                 dep.objectId,
-                                                                                                nspOid);
+                                                                                                nspOid,
+                                                                                                objsMoved);
 
                /*
                 * Remember previous namespace of first object that has one
index b298d11d82072f978a763237833ec3cf4f239147..d963f6985b8557f70241c58e7e3aba000bd836e0 100644 (file)
@@ -261,10 +261,10 @@ static void StoreCatalogInheritance1(Oid relationId, Oid parentOid,
                                                 int16 seqNumber, Relation inhRelation);
 static int     findAttrByName(const char *attributeName, List *schema);
 static void AlterIndexNamespaces(Relation classRel, Relation rel,
-                                        Oid oldNspOid, Oid newNspOid);
+                                        Oid oldNspOid, Oid newNspOid, ObjectAddresses *objsMoved);
 static void AlterSeqNamespaces(Relation classRel, Relation rel,
-                                  Oid oldNspOid, Oid newNspOid,
-                                  const char *newNspName, LOCKMODE lockmode);
+                                  Oid oldNspOid, Oid newNspOid, ObjectAddresses *objsMoved,
+                                  LOCKMODE lockmode);
 static void ATExecValidateConstraint(Relation rel, char *constrName,
                                                 bool recurse, bool recursing, LOCKMODE lockmode);
 static int transformColumnNameList(Oid relId, List *colList,
@@ -9732,8 +9732,8 @@ AlterTableNamespace(AlterObjectSchemaStmt *stmt)
        Oid                     relid;
        Oid                     oldNspOid;
        Oid                     nspOid;
-       Relation        classRel;
        RangeVar   *newrv;
+       ObjectAddresses *objsMoved;
 
        relid = RangeVarGetRelidExtended(stmt->relation, AccessExclusiveLock,
                                                                         stmt->missing_ok, false,
@@ -9774,27 +9774,47 @@ AlterTableNamespace(AlterObjectSchemaStmt *stmt)
        /* common checks on switching namespaces */
        CheckSetNamespace(oldNspOid, nspOid, RelationRelationId, relid);
 
+       objsMoved = new_object_addresses();
+       AlterTableNamespaceInternal(rel, oldNspOid, nspOid, objsMoved);
+       free_object_addresses(objsMoved);
+
+       /* close rel, but keep lock until commit */
+       relation_close(rel, NoLock);
+}
+
+/*
+ * The guts of relocating a table to another namespace: besides moving
+ * the table itself, its dependent objects are relocated to the new schema.
+ */
+void
+AlterTableNamespaceInternal(Relation rel, Oid oldNspOid, Oid nspOid,
+                                                       ObjectAddresses *objsMoved)
+{
+       Relation        classRel;
+
+       Assert(objsMoved != NULL);
+
        /* OK, modify the pg_class row and pg_depend entry */
        classRel = heap_open(RelationRelationId, RowExclusiveLock);
 
-       AlterRelationNamespaceInternal(classRel, relid, oldNspOid, nspOid, true);
+       AlterRelationNamespaceInternal(classRel, RelationGetRelid(rel), oldNspOid,
+                                                                  nspOid, true, objsMoved);
 
        /* Fix the table's row type too */
-       AlterTypeNamespaceInternal(rel->rd_rel->reltype, nspOid, false, false);
+       AlterTypeNamespaceInternal(rel->rd_rel->reltype,
+                                                          nspOid, false, false, objsMoved);
 
        /* Fix other dependent stuff */
        if (rel->rd_rel->relkind == RELKIND_RELATION)
        {
-               AlterIndexNamespaces(classRel, rel, oldNspOid, nspOid);
-               AlterSeqNamespaces(classRel, rel, oldNspOid, nspOid, stmt->newschema,
-                                                  AccessExclusiveLock);
-               AlterConstraintNamespaces(relid, oldNspOid, nspOid, false);
+               AlterIndexNamespaces(classRel, rel, oldNspOid, nspOid, objsMoved);
+               AlterSeqNamespaces(classRel, rel, oldNspOid, nspOid,
+                                                  objsMoved, AccessExclusiveLock);
+               AlterConstraintNamespaces(RelationGetRelid(rel), oldNspOid, nspOid,
+                                                                 false, objsMoved);
        }
 
        heap_close(classRel, RowExclusiveLock);
-
-       /* close rel, but keep lock until commit */
-       relation_close(rel, NoLock);
 }
 
 /*
@@ -9805,10 +9825,11 @@ AlterTableNamespace(AlterObjectSchemaStmt *stmt)
 void
 AlterRelationNamespaceInternal(Relation classRel, Oid relOid,
                                                           Oid oldNspOid, Oid newNspOid,
-                                                          bool hasDependEntry)
+                                                          bool hasDependEntry, ObjectAddresses *objsMoved)
 {
        HeapTuple       classTup;
        Form_pg_class classForm;
+       ObjectAddress   thisobj;
 
        classTup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relOid));
        if (!HeapTupleIsValid(classTup))
@@ -9817,27 +9838,39 @@ AlterRelationNamespaceInternal(Relation classRel, Oid relOid,
 
        Assert(classForm->relnamespace == oldNspOid);
 
-       /* check for duplicate name (more friendly than unique-index failure) */
-       if (get_relname_relid(NameStr(classForm->relname),
-                                                 newNspOid) != InvalidOid)
-               ereport(ERROR,
-                               (errcode(ERRCODE_DUPLICATE_TABLE),
-                                errmsg("relation \"%s\" already exists in schema \"%s\"",
-                                               NameStr(classForm->relname),
-                                               get_namespace_name(newNspOid))));
+       thisobj.classId = RelationRelationId;
+       thisobj.objectId = relOid;
+       thisobj.objectSubId = 0;
+
+       /*
+        * Do nothing when there's nothing to do.
+        */
+       if (!object_address_present(&thisobj, objsMoved))
+       {
+               /* check for duplicate name (more friendly than unique-index failure) */
+               if (get_relname_relid(NameStr(classForm->relname),
+                                                         newNspOid) != InvalidOid)
+                       ereport(ERROR,
+                                       (errcode(ERRCODE_DUPLICATE_TABLE),
+                                        errmsg("relation \"%s\" already exists in schema \"%s\"",
+                                                       NameStr(classForm->relname),
+                                                       get_namespace_name(newNspOid))));
 
-       /* classTup is a copy, so OK to scribble on */
-       classForm->relnamespace = newNspOid;
+               /* classTup is a copy, so OK to scribble on */
+               classForm->relnamespace = newNspOid;
 
-       simple_heap_update(classRel, &classTup->t_self, classTup);
-       CatalogUpdateIndexes(classRel, classTup);
+               simple_heap_update(classRel, &classTup->t_self, classTup);
+               CatalogUpdateIndexes(classRel, classTup);
 
-       /* Update dependency on schema if caller said so */
-       if (hasDependEntry &&
-               changeDependencyFor(RelationRelationId, relOid,
-                                                       NamespaceRelationId, oldNspOid, newNspOid) != 1)
-               elog(ERROR, "failed to change schema dependency for relation \"%s\"",
-                        NameStr(classForm->relname));
+               /* Update dependency on schema if caller said so */
+               if (hasDependEntry &&
+                       changeDependencyFor(RelationRelationId, relOid,
+                                                               NamespaceRelationId, oldNspOid, newNspOid) != 1)
+                       elog(ERROR, "failed to change schema dependency for relation \"%s\"",
+                                NameStr(classForm->relname));
+
+               add_exact_object_address(&thisobj, objsMoved);
+       }
 
        heap_freetuple(classTup);
 }
@@ -9850,7 +9883,7 @@ AlterRelationNamespaceInternal(Relation classRel, Oid relOid,
  */
 static void
 AlterIndexNamespaces(Relation classRel, Relation rel,
-                                        Oid oldNspOid, Oid newNspOid)
+                                        Oid oldNspOid, Oid newNspOid, ObjectAddresses *objsMoved)
 {
        List       *indexList;
        ListCell   *l;
@@ -9860,15 +9893,27 @@ AlterIndexNamespaces(Relation classRel, Relation rel,
        foreach(l, indexList)
        {
                Oid                     indexOid = lfirst_oid(l);
+               ObjectAddress thisobj;
+
+               thisobj.classId = RelationRelationId;
+               thisobj.objectId = indexOid;
+               thisobj.objectSubId = 0;
 
                /*
                 * Note: currently, the index will not have its own dependency on the
                 * namespace, so we don't need to do changeDependencyFor(). There's no
                 * row type in pg_type, either.
+                *
+                * XXX this objsMoved test may be pointless -- surely we have a single
+                * dependency link from a relation to each index?
                 */
-               AlterRelationNamespaceInternal(classRel, indexOid,
-                                                                          oldNspOid, newNspOid,
-                                                                          false);
+               if (!object_address_present(&thisobj, objsMoved))
+               {
+                       AlterRelationNamespaceInternal(classRel, indexOid,
+                                                                                  oldNspOid, newNspOid,
+                                                                                  false, objsMoved);
+                       add_exact_object_address(&thisobj, objsMoved);
+               }
        }
 
        list_free(indexList);
@@ -9883,7 +9928,8 @@ AlterIndexNamespaces(Relation classRel, Relation rel,
  */
 static void
 AlterSeqNamespaces(Relation classRel, Relation rel,
-        Oid oldNspOid, Oid newNspOid, const char *newNspName, LOCKMODE lockmode)
+                                  Oid oldNspOid, Oid newNspOid, ObjectAddresses *objsMoved,
+                                  LOCKMODE lockmode)
 {
        Relation        depRel;
        SysScanDesc scan;
@@ -9935,14 +9981,14 @@ AlterSeqNamespaces(Relation classRel, Relation rel,
                /* Fix the pg_class and pg_depend entries */
                AlterRelationNamespaceInternal(classRel, depForm->objid,
                                                                           oldNspOid, newNspOid,
-                                                                          true);
+                                                                          true, objsMoved);
 
                /*
                 * Sequences have entries in pg_type. We need to be careful to move
                 * them to the new namespace, too.
                 */
                AlterTypeNamespaceInternal(RelationGetForm(seqRel)->reltype,
-                                                                  newNspOid, false, false);
+                                                                  newNspOid, false, false, objsMoved);
 
                /* Now we can close it.  Keep the lock till end of transaction. */
                relation_close(seqRel, NoLock);
index 4bc6358cadd46c6c55567a3b9bdf5685e0b83497..15bfdc60923f1fe98036428e595f44ccf76d56c2 100644 (file)
@@ -3343,6 +3343,7 @@ AlterTypeNamespace(List *names, const char *newschema, ObjectType objecttype)
        TypeName   *typename;
        Oid                     typeOid;
        Oid                     nspOid;
+       ObjectAddresses *objsMoved;
 
        /* Make a TypeName so we can use standard type lookup machinery */
        typename = makeTypeNameFromNameList(names);
@@ -3358,11 +3359,13 @@ AlterTypeNamespace(List *names, const char *newschema, ObjectType objecttype)
        /* get schema OID and check its permissions */
        nspOid = LookupCreationNamespace(newschema);
 
-       AlterTypeNamespace_oid(typeOid, nspOid);
+       objsMoved = new_object_addresses();
+       AlterTypeNamespace_oid(typeOid, nspOid, objsMoved);
+       free_object_addresses(objsMoved);
 }
 
 Oid
-AlterTypeNamespace_oid(Oid typeOid, Oid nspOid)
+AlterTypeNamespace_oid(Oid typeOid, Oid nspOid, ObjectAddresses *objsMoved)
 {
        Oid                     elemOid;
 
@@ -3381,7 +3384,7 @@ AlterTypeNamespace_oid(Oid typeOid, Oid nspOid)
                                                 format_type_be(elemOid))));
 
        /* and do the work */
-       return AlterTypeNamespaceInternal(typeOid, nspOid, false, true);
+       return AlterTypeNamespaceInternal(typeOid, nspOid, false, true, objsMoved);
 }
 
 /*
@@ -3402,7 +3405,8 @@ AlterTypeNamespace_oid(Oid typeOid, Oid nspOid)
 Oid
 AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid,
                                                   bool isImplicitArray,
-                                                  bool errorOnTableType)
+                                                  bool errorOnTableType,
+                                                  ObjectAddresses *objsMoved)
 {
        Relation        rel;
        HeapTuple       tup;
@@ -3410,6 +3414,17 @@ AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid,
        Oid                     oldNspOid;
        Oid                     arrayOid;
        bool            isCompositeType;
+       ObjectAddress thisobj;
+
+       /*
+        * Make sure we haven't moved this object previously.
+        */
+       thisobj.classId = TypeRelationId;
+       thisobj.objectId = typeOid;
+       thisobj.objectSubId = 0;
+
+       if (object_address_present(&thisobj, objsMoved))
+               return InvalidOid;
 
        rel = heap_open(TypeRelationId, RowExclusiveLock);
 
@@ -3470,7 +3485,7 @@ AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid,
 
                AlterRelationNamespaceInternal(classRel, typform->typrelid,
                                                                           oldNspOid, nspOid,
-                                                                          false);
+                                                                          false, objsMoved);
 
                heap_close(classRel, RowExclusiveLock);
 
@@ -3479,13 +3494,14 @@ AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid,
                 * currently support this, but probably will someday).
                 */
                AlterConstraintNamespaces(typform->typrelid, oldNspOid,
-                                                                 nspOid, false);
+                                                                 nspOid, false, objsMoved);
        }
        else
        {
                /* If it's a domain, it might have constraints */
                if (typform->typtype == TYPTYPE_DOMAIN)
-                       AlterConstraintNamespaces(typeOid, oldNspOid, nspOid, true);
+                       AlterConstraintNamespaces(typeOid, oldNspOid, nspOid, true,
+                                                                         objsMoved);
        }
 
        /*
@@ -3503,9 +3519,11 @@ AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid,
 
        heap_close(rel, RowExclusiveLock);
 
+       add_exact_object_address(&thisobj, objsMoved);
+
        /* Recursively alter the associated array type, if any */
        if (OidIsValid(arrayOid))
-               AlterTypeNamespaceInternal(arrayOid, nspOid, true, true);
+               AlterTypeNamespaceInternal(arrayOid, nspOid, true, true, objsMoved);
 
        return oldNspOid;
 }
index 9cc7bf7c260f601859f4e10a93f2bf84d73a0fa4..d9d40b26873a08de87651c2b3f27258f557d6ef5 100644 (file)
@@ -20,6 +20,7 @@
 #define PG_CONSTRAINT_H
 
 #include "catalog/genbki.h"
+#include "catalog/dependency.h"
 #include "nodes/pg_list.h"
 
 /* ----------------
@@ -244,7 +245,7 @@ extern char *ChooseConstraintName(const char *name1, const char *name2,
                                         List *others);
 
 extern void AlterConstraintNamespaces(Oid ownerId, Oid oldNspId,
-                                                 Oid newNspId, bool isType);
+                                                 Oid newNspId, bool isType, ObjectAddresses *objsMoved);
 extern Oid     get_relation_constraint_oid(Oid relid, const char *conname, bool missing_ok);
 extern Oid     get_domain_constraint_oid(Oid typid, const char *conname, bool missing_ok);
 
index 210cf4eacdc0bc5d1592da4512ceab0cd4de6355..173188e6f296568a33887c3813eb05b11e3aab70 100644 (file)
 #ifndef ALTER_H
 #define ALTER_H
 
+#include "catalog/dependency.h"
 #include "utils/acl.h"
 #include "utils/relcache.h"
 
 extern void ExecRenameStmt(RenameStmt *stmt);
 extern void ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt);
-extern Oid     AlterObjectNamespace_oid(Oid classId, Oid objid, Oid nspOid);
+extern Oid AlterObjectNamespace_oid(Oid classId, Oid objid, Oid nspOid,
+                                                ObjectAddresses *objsMoved);
 extern Oid AlterObjectNamespace(Relation rel, int oidCacheId, int nameCacheId,
                                         Oid objid, Oid nspOid,
                                         int Anum_name, int Anum_namespace, int Anum_owner,
index 15d4713cec16ff9e2c4366deedf6aca807516cf5..4f32062056fba39c25c89d287fc831e927918db6 100644 (file)
@@ -15,6 +15,7 @@
 #define TABLECMDS_H
 
 #include "access/htup.h"
+#include "catalog/dependency.h"
 #include "nodes/parsenodes.h"
 #include "storage/lock.h"
 #include "utils/relcache.h"
@@ -36,9 +37,13 @@ extern void AlterTableInternal(Oid relid, List *cmds, bool recurse);
 
 extern void AlterTableNamespace(AlterObjectSchemaStmt *stmt);
 
+extern void AlterTableNamespaceInternal(Relation rel, Oid oldNspOid,
+                                                       Oid nspOid, ObjectAddresses *objsMoved);
+
 extern void AlterRelationNamespaceInternal(Relation classRel, Oid relOid,
                                                           Oid oldNspOid, Oid newNspOid,
-                                                          bool hasDependEntry);
+                                                          bool hasDependEntry,
+                                                          ObjectAddresses *objsMoved);
 
 extern void CheckTableNotInUse(Relation rel, const char *stmt);
 
index b72cfc4fd94457f2a6419472330fcdcee0a068c2..2351024c2212199dac3563c222aa171a3dacc8cd 100644 (file)
@@ -15,6 +15,7 @@
 #define TYPECMDS_H
 
 #include "access/htup.h"
+#include "catalog/dependency.h"
 #include "nodes/parsenodes.h"
 
 
@@ -45,9 +46,10 @@ extern void AlterTypeOwner(List *names, Oid newOwnerId, ObjectType objecttype);
 extern void AlterTypeOwnerInternal(Oid typeOid, Oid newOwnerId,
                                           bool hasDependEntry);
 extern void AlterTypeNamespace(List *names, const char *newschema, ObjectType objecttype);
-extern Oid     AlterTypeNamespace_oid(Oid typeOid, Oid nspOid);
-extern Oid AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid,
+extern Oid     AlterTypeNamespace_oid(Oid typeOid, Oid nspOid, ObjectAddresses *objsMoved);
+extern Oid     AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid,
                                                   bool isImplicitArray,
-                                                  bool errorOnTableType);
+                                                  bool errorOnTableType,
+                                                  ObjectAddresses *objsMoved);
 
 #endif   /* TYPECMDS_H */