Support toasting of shared system relations, and provide toast tables for

pg_database, pg_shadow, pg_group, all of which now have potentially-long
fields.  Along the way, get rid of SharedSystemRelationNames list: shared
rels are now identified in their include/pg_catalog/*.h files by a
BKI_SHARED_RELATION macro, while indexes and toast rels inherit sharedness
automatically from their parent table.  Fix some bugs with failure to detoast
pg_group.grolist during ALTER GROUP.
This commit is contained in:
Tom Lane
2002-04-27 21:24:34 +00:00
parent 108871f4fc
commit c06f6a6bc2
27 changed files with 403 additions and 531 deletions

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: bootstrap.h,v 1.28 2002/03/26 19:16:20 tgl Exp $
* $Id: bootstrap.h,v 1.29 2002/04/27 21:24:34 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -31,7 +31,7 @@ typedef struct hashnode
} hashnode;
extern Relation reldesc;
extern Relation boot_reldesc;
extern Form_pg_attribute attrtypes[MAXATTR];
extern int numattr;
extern int BootstrapMain(int ac, char *av[]);

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: catalog.h,v 1.23 2002/04/12 20:38:30 tgl Exp $
* $Id: catalog.h,v 1.24 2002/04/27 21:24:34 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -30,7 +30,6 @@ extern bool IsSystemNamespace(Oid namespaceId);
extern bool IsToastNamespace(Oid namespaceId);
extern bool IsReservedName(const char *name);
extern bool IsSharedSystemRelationName(const char *relname);
extern Oid newoid(void);

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: catname.h,v 1.24 2002/03/22 21:34:44 tgl Exp $
* $Id: catname.h,v 1.25 2002/04/27 21:24:34 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -42,6 +42,4 @@
#define RelCheckRelationName "pg_relcheck"
#define TriggerRelationName "pg_trigger"
extern char *SharedSystemRelationNames[];
#endif /* CATNAME_H */

View File

@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: catversion.h,v 1.127 2002/04/26 01:24:08 tgl Exp $
* $Id: catversion.h,v 1.128 2002/04/27 21:24:34 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -53,6 +53,6 @@
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 200204251
#define CATALOG_VERSION_NO 200204271
#endif

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: heap.h,v 1.49 2002/03/31 06:26:32 tgl Exp $
* $Id: heap.h,v 1.50 2002/04/27 21:24:34 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -30,6 +30,7 @@ typedef struct RawColumnDefault
extern Relation heap_create(const char *relname,
Oid relnamespace,
TupleDesc tupDesc,
bool shared_relation,
bool storage_create,
bool allow_system_table_mods);
@ -39,6 +40,7 @@ extern Oid heap_create_with_catalog(const char *relname,
Oid relnamespace,
TupleDesc tupdesc,
char relkind,
bool shared_relation,
bool relhasoids,
bool allow_system_table_mods);

View File

@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_database.h,v 1.23 2002/04/21 00:26:43 tgl Exp $
* $Id: pg_database.h,v 1.24 2002/04/27 21:24:34 tgl Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@ -31,7 +31,7 @@
* typedef struct FormData_pg_database
* ----------------
*/
CATALOG(pg_database) BOOTSTRAP
CATALOG(pg_database) BOOTSTRAP BKI_SHARED_RELATION
{
NameData datname; /* database name */
int4 datdba; /* sysid of owner */

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_group.h,v 1.13 2001/11/05 17:46:32 momjian Exp $
* $Id: pg_group.h,v 1.14 2002/04/27 21:24:34 tgl Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@ -25,7 +25,7 @@
* ----------------
*/
CATALOG(pg_group) BOOTSTRAP BKI_WITHOUT_OIDS
CATALOG(pg_group) BOOTSTRAP BKI_SHARED_RELATION BKI_WITHOUT_OIDS
{
NameData groname;
int4 grosysid;

View File

@ -9,7 +9,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_shadow.h,v 1.19 2002/04/11 05:32:03 petere Exp $
* $Id: pg_shadow.h,v 1.20 2002/04/27 21:24:34 tgl Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@ -29,7 +29,7 @@
* typedef struct FormData_pg_shadow
* ----------------
*/
CATALOG(pg_shadow) BOOTSTRAP BKI_WITHOUT_OIDS
CATALOG(pg_shadow) BOOTSTRAP BKI_SHARED_RELATION BKI_WITHOUT_OIDS
{
NameData usename;
int4 usesysid;
@ -37,8 +37,9 @@ CATALOG(pg_shadow) BOOTSTRAP BKI_WITHOUT_OIDS
bool usetrace;
bool usesuper; /* read this field via superuser() only */
bool usecatupd;
/* remaining fields may be null; use heap_getattr to read them! */
text passwd;
int4 valuntil;
int4 valuntil; /* actually abstime */
text useconfig[1];
} FormData_pg_shadow;

View File

@ -10,7 +10,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1995, Regents of the University of California
*
* $Id: postgres.h,v 1.56 2001/11/05 17:46:31 momjian Exp $
* $Id: postgres.h,v 1.57 2002/04/27 21:24:34 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -597,7 +597,7 @@ extern int assertTest(int val);
#define CATALOG(x) typedef struct CppConcat(FormData_,x)
#define BOOTSTRAP
#define BKI_SHARED_RELATION
#define BKI_WITHOUT_OIDS
/* these need to expand into some harmless, repeatable declaration */