#include "catalog/genbki.h"
Go to the source code of this file.
Defines | |
#define | RangeRelationId 3541 |
#define | Natts_pg_range 6 |
#define | Anum_pg_range_rngtypid 1 |
#define | Anum_pg_range_rngsubtype 2 |
#define | Anum_pg_range_rngcollation 3 |
#define | Anum_pg_range_rngsubopc 4 |
#define | Anum_pg_range_rngcanonical 5 |
#define | Anum_pg_range_rngsubdiff 6 |
Typedefs | |
typedef FormData_pg_range * | Form_pg_range |
Functions | |
CATALOG (pg_range, 3541) BKI_WITHOUT_OIDS | |
DATA (insert(3904 23 0 1978 int4range_canonical int4range_subdiff)) | |
DATA (insert(3906 1700 0 3125-numrange_subdiff)) | |
DATA (insert(3908 1114 0 3128-tsrange_subdiff)) | |
DATA (insert(3910 1184 0 3127-tstzrange_subdiff)) | |
DATA (insert(3912 1082 0 3122 daterange_canonical daterange_subdiff)) | |
DATA (insert(3926 20 0 3124 int8range_canonical int8range_subdiff)) | |
void | RangeCreate (Oid rangeTypeOid, Oid rangeSubType, Oid rangeCollation, Oid rangeSubOpclass, RegProcedure rangeCanonical, RegProcedure rangeSubDiff) |
void | RangeDelete (Oid rangeTypeOid) |
Variables | |
FormData_pg_range |
#define Anum_pg_range_rngcanonical 5 |
Definition at line 60 of file pg_range.h.
Referenced by RangeCreate().
#define Anum_pg_range_rngcollation 3 |
Definition at line 58 of file pg_range.h.
Referenced by RangeCreate().
#define Anum_pg_range_rngsubdiff 6 |
Definition at line 61 of file pg_range.h.
Referenced by RangeCreate().
#define Anum_pg_range_rngsubopc 4 |
Definition at line 59 of file pg_range.h.
Referenced by RangeCreate().
#define Anum_pg_range_rngsubtype 2 |
Definition at line 57 of file pg_range.h.
Referenced by RangeCreate().
#define Anum_pg_range_rngtypid 1 |
Definition at line 56 of file pg_range.h.
Referenced by RangeCreate(), and RangeDelete().
#define Natts_pg_range 6 |
Definition at line 55 of file pg_range.h.
#define RangeRelationId 3541 |
Definition at line 32 of file pg_range.h.
Referenced by RangeCreate(), and RangeDelete().
typedef FormData_pg_range* Form_pg_range |
Definition at line 49 of file pg_range.h.
CATALOG | ( | pg_range | , | |
3541 | ||||
) |
Definition at line 34 of file pg_range.h.
{ Oid rngtypid; /* OID of owning range type */ Oid rngsubtype; /* OID of range's element type (subtype) */ Oid rngcollation; /* collation for this range type, or 0 */ Oid rngsubopc; /* subtype's btree opclass */ regproc rngcanonical; /* canonicalize range, or 0 */ regproc rngsubdiff; /* subtype difference as a float8, or 0 */ } FormData_pg_range;
DATA | ( | insert(3904 23 0 1978 int4range_canonical int4range_subdiff) | ) |
DATA | ( | insert(3908 1114 0 3128-tsrange_subdiff) | ) |
DATA | ( | insert(3926 20 0 3124 int8range_canonical int8range_subdiff) | ) |
DATA | ( | insert(3912 1082 0 3122 daterange_canonical daterange_subdiff) | ) |
DATA | ( | insert(3910 1184 0 3127-tstzrange_subdiff) | ) |
DATA | ( | insert(3906 1700 0 3125-numrange_subdiff) | ) |
void RangeCreate | ( | Oid | rangeTypeOid, | |
Oid | rangeSubType, | |||
Oid | rangeCollation, | |||
Oid | rangeSubOpclass, | |||
RegProcedure | rangeCanonical, | |||
RegProcedure | rangeSubDiff | |||
) |
Definition at line 37 of file pg_range.c.
References Anum_pg_range_rngcanonical, Anum_pg_range_rngcollation, Anum_pg_range_rngsubdiff, Anum_pg_range_rngsubopc, Anum_pg_range_rngsubtype, Anum_pg_range_rngtypid, CatalogUpdateIndexes(), ObjectAddress::classId, DEPENDENCY_NORMAL, heap_close, heap_form_tuple(), heap_freetuple(), heap_open(), ObjectAddress::objectId, ObjectIdGetDatum, ObjectAddress::objectSubId, OidIsValid, RangeRelationId, recordDependencyOn(), RelationGetDescr, RowExclusiveLock, simple_heap_insert(), and values.
Referenced by DefineRange().
{ Relation pg_range; Datum values[Natts_pg_range]; bool nulls[Natts_pg_range]; HeapTuple tup; ObjectAddress myself; ObjectAddress referenced; pg_range = heap_open(RangeRelationId, RowExclusiveLock); memset(nulls, 0, sizeof(nulls)); values[Anum_pg_range_rngtypid - 1] = ObjectIdGetDatum(rangeTypeOid); values[Anum_pg_range_rngsubtype - 1] = ObjectIdGetDatum(rangeSubType); values[Anum_pg_range_rngcollation - 1] = ObjectIdGetDatum(rangeCollation); values[Anum_pg_range_rngsubopc - 1] = ObjectIdGetDatum(rangeSubOpclass); values[Anum_pg_range_rngcanonical - 1] = ObjectIdGetDatum(rangeCanonical); values[Anum_pg_range_rngsubdiff - 1] = ObjectIdGetDatum(rangeSubDiff); tup = heap_form_tuple(RelationGetDescr(pg_range), values, nulls); simple_heap_insert(pg_range, tup); CatalogUpdateIndexes(pg_range, tup); heap_freetuple(tup); /* record type's dependencies on range-related items */ myself.classId = TypeRelationId; myself.objectId = rangeTypeOid; myself.objectSubId = 0; referenced.classId = TypeRelationId; referenced.objectId = rangeSubType; referenced.objectSubId = 0; recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL); referenced.classId = OperatorClassRelationId; referenced.objectId = rangeSubOpclass; referenced.objectSubId = 0; recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL); if (OidIsValid(rangeCollation)) { referenced.classId = CollationRelationId; referenced.objectId = rangeCollation; referenced.objectSubId = 0; recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL); } if (OidIsValid(rangeCanonical)) { referenced.classId = ProcedureRelationId; referenced.objectId = rangeCanonical; referenced.objectSubId = 0; recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL); } if (OidIsValid(rangeSubDiff)) { referenced.classId = ProcedureRelationId; referenced.objectId = rangeSubDiff; referenced.objectSubId = 0; recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL); } heap_close(pg_range, RowExclusiveLock); }
void RangeDelete | ( | Oid | rangeTypeOid | ) |
Definition at line 114 of file pg_range.c.
References Anum_pg_range_rngtypid, BTEqualStrategyNumber, heap_close, heap_open(), HeapTupleIsValid, ObjectIdGetDatum, RangeRelationId, RangeTypidIndexId, RowExclusiveLock, ScanKeyInit(), simple_heap_delete(), SnapshotNow, systable_beginscan(), systable_endscan(), systable_getnext(), and HeapTupleData::t_self.
Referenced by RemoveTypeById().
{ Relation pg_range; ScanKeyData key[1]; SysScanDesc scan; HeapTuple tup; pg_range = heap_open(RangeRelationId, RowExclusiveLock); ScanKeyInit(&key[0], Anum_pg_range_rngtypid, BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(rangeTypeOid)); scan = systable_beginscan(pg_range, RangeTypidIndexId, true, SnapshotNow, 1, key); while (HeapTupleIsValid(tup = systable_getnext(scan))) { simple_heap_delete(pg_range, &tup->t_self); } systable_endscan(scan); heap_close(pg_range, RowExclusiveLock); }
Definition at line 42 of file pg_range.h.