Fix illegal combination of SearchSysCacheTuple() and heap_freetuple()
authorHiroshi Inoue <inoue@tpf.co.jp>
Tue, 14 Nov 2000 01:57:30 +0000 (01:57 +0000)
committerHiroshi Inoue <inoue@tpf.co.jp>
Tue, 14 Nov 2000 01:57:30 +0000 (01:57 +0000)
in AlterTableOwner().

src/backend/commands/command.c

index 3d63bc7ec7e7e0f7151ff842f2697030301b5f1b..fe548802fb227a999e9a1f2014aa22ff390865e4 100644 (file)
@@ -1447,14 +1447,13 @@ AlterTableOwner(const char *relationName, const char *newOwnerName)
                elog(ERROR, "ALTER TABLE: user \"%s\" not found", newOwnerName);
 
        newOwnerSysid = ((Form_pg_shadow) GETSTRUCT(tuple))->usesysid;
-       heap_freetuple(tuple);
 
        /*
         * find the table's entry in pg_class and lock it for writing
         */
        class_rel = heap_openr(RelationRelationName, RowExclusiveLock);
 
-       tuple = SearchSysCacheTuple(RELNAME, PointerGetDatum(relationName),
+       tuple = SearchSysCacheTupleCopy(RELNAME, PointerGetDatum(relationName),
                                                                 0, 0, 0);
        if (!HeapTupleIsValid(tuple))
                elog(ERROR, "ALTER TABLE: relation \"%s\" not found",