1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-27 07:42:10 +03:00

Revert patch, doesn't do what it should:

* %Disallow changing default expression of a SERIAL column

Dhanaraj M
This commit is contained in:
Bruce Momjian
2006-06-27 18:35:05 +00:00
parent cdd5178c69
commit 33b4ad66c9
7 changed files with 14 additions and 151 deletions

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.300 2006/06/27 03:21:54 momjian Exp $
* $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.301 2006/06/27 18:35:05 momjian Exp $
*
*
* INTERFACE ROUTINES
@@ -2133,50 +2133,3 @@ heap_truncate_find_FKs(List *relationIds)
return result;
}
/* Detach the default sequence and the relation */
void
RemoveSequenceDefault(Oid relid, AttrNumber attnum,
DropBehavior behavior, bool flag)
{
Relation attrdef_rel;
ScanKeyData scankeys[2];
SysScanDesc scan;
HeapTuple tuple;
attrdef_rel = heap_open(AttrDefaultRelationId, RowExclusiveLock);
ScanKeyInit(&scankeys[0],
Anum_pg_attrdef_adrelid,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(relid));
ScanKeyInit(&scankeys[1],
Anum_pg_attrdef_adnum,
BTEqualStrategyNumber, F_INT2EQ,
Int16GetDatum(attnum));
scan = systable_beginscan(attrdef_rel, AttrDefaultIndexId, true,
SnapshotNow, 2, scankeys);
/* There should be at most one matching tuple, but we loop anyway */
while (HeapTupleIsValid(tuple = systable_getnext(scan)))
{
ObjectAddress object;
object.classId = AttrDefaultRelationId;
object.objectId = HeapTupleGetOid(tuple);
object.objectSubId = 0;
if(flag == true) /* Detach the sequence */
performSequenceDefaultDeletion(&object, behavior, 0);
else /* Don't allow to change the default sequence */
performSequenceDefaultDeletion(&object, behavior, 2);
}
systable_endscan(scan);
heap_close(attrdef_rel, RowExclusiveLock);
}