---------------- * populate_typ_list * * Load the Typ list by reading pg_type. * ---------------- */
| 917 | * ---------------- |
| 918 | */ |
| 919 | static void |
| 920 | populate_typ_list(void) |
| 921 | { |
| 922 | Relation rel; |
| 923 | TableScanDesc scan; |
| 924 | HeapTuple tup; |
| 925 | MemoryContext old; |
| 926 | |
| 927 | Assert(Typ == NIL); |
| 928 | |
| 929 | rel = table_open(TypeRelationId, NoLock); |
| 930 | scan = table_beginscan_catalog(rel, 0, NULL); |
| 931 | old = MemoryContextSwitchTo(TopMemoryContext); |
| 932 | while ((tup = heap_getnext(scan, ForwardScanDirection)) != NULL) |
| 933 | { |
| 934 | Form_pg_type typForm = (Form_pg_type) GETSTRUCT(tup); |
| 935 | struct typmap *newtyp; |
| 936 | |
| 937 | newtyp = (struct typmap *) palloc(sizeof(struct typmap)); |
| 938 | Typ = lappend(Typ, newtyp); |
| 939 | |
| 940 | newtyp->am_oid = typForm->oid; |
| 941 | memcpy(&newtyp->am_typ, typForm, sizeof(newtyp->am_typ)); |
| 942 | } |
| 943 | MemoryContextSwitchTo(old); |
| 944 | table_endscan(scan); |
| 945 | table_close(rel, NoLock); |
| 946 | } |
| 947 | |
| 948 | /* ---------------- |
| 949 | * gettype |
no test coverage detected