diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c index d8008c9811c4f17980789355220c6ddf1c9f284f..25eba1406fb7b8f16fc71415212d1d2bf6680fc9 100644 --- a/src/backend/bootstrap/bootstrap.c +++ b/src/backend/bootstrap/bootstrap.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.243 2008/05/12 00:00:46 alvherre Exp $ + * $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.244 2008/06/24 17:58:27 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -125,7 +125,7 @@ static const struct typinfo TypInfo[] = { F_INT4IN, F_INT4OUT}, {"float4", FLOAT4OID, 0, 4, FLOAT4PASSBYVAL, 'i', 'p', F_FLOAT4IN, F_FLOAT4OUT}, - {"name", NAMEOID, CHAROID, NAMEDATALEN, false, 'i', 'p', + {"name", NAMEOID, CHAROID, NAMEDATALEN, false, 'c', 'p', F_NAMEIN, F_NAMEOUT}, {"regclass", REGCLASSOID, 0, 4, true, 'i', 'p', F_REGCLASSIN, F_REGCLASSOUT}, diff --git a/src/backend/utils/adt/name.c b/src/backend/utils/adt/name.c index 96f398e5bb284e51f3065b0e17865748c5cf541b..701b0fd4a5c82a229fe5109d544ba2ed8d49d3cc 100644 --- a/src/backend/utils/adt/name.c +++ b/src/backend/utils/adt/name.c @@ -14,7 +14,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/name.c,v 1.62 2008/05/27 00:13:09 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/name.c,v 1.63 2008/06/24 17:58:27 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -315,7 +315,7 @@ current_schemas(PG_FUNCTION_ARGS) NAMEOID, NAMEDATALEN, /* sizeof(Name) */ false, /* Name is not by-val */ - 'i'); /* alignment of Name */ + 'c'); /* alignment of Name */ PG_RETURN_POINTER(array); } diff --git a/src/include/c.h b/src/include/c.h index 16ccb4cf4e3097783dca4c038d19f4321c1f0ad5..d8fa1d25d20fcb505f510b151c5646d17a8bb935 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -12,7 +12,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/c.h,v 1.227 2008/06/17 16:09:06 momjian Exp $ + * $PostgreSQL: pgsql/src/include/c.h,v 1.228 2008/06/24 17:58:27 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -442,16 +442,12 @@ typedef struct } oidvector; /* VARIABLE LENGTH STRUCT */ /* - * We want NameData to have length NAMEDATALEN and int alignment, - * because that's how the data type 'name' is defined in pg_type. - * Use a union to make sure the compiler agrees. Note that NAMEDATALEN - * must be a multiple of sizeof(int), else sizeof(NameData) will probably - * not come out equal to NAMEDATALEN. + * Representation of a Name: effectively just a C string, but null-padded to + * exactly NAMEDATALEN bytes. The use of a struct is historical. */ -typedef union nameData +typedef struct nameData { char data[NAMEDATALEN]; - int alignmentDummy; } NameData; typedef NameData *Name; diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 5b434df51564e37f68b06def9d642d75a8db9b5d..a49beccd54f1b337f985589df4fe71a688d69cb8 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -37,7 +37,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.463 2008/06/17 19:10:56 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.464 2008/06/24 17:58:27 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 200806171 +#define CATALOG_VERSION_NO 200806241 #endif diff --git a/src/include/catalog/pg_attribute.h b/src/include/catalog/pg_attribute.h index 1378f109f6ef2d3764075331f0de25b2c3e746db..278b7387a506463fc1463bafba21f27fb5fe7285 100644 --- a/src/include/catalog/pg_attribute.h +++ b/src/include/catalog/pg_attribute.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_attribute.h,v 1.137 2008/04/21 00:26:46 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_attribute.h,v 1.138 2008/06/24 17:58:27 tgl Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -217,7 +217,7 @@ typedef FormData_pg_attribute *Form_pg_attribute; * ---------------- */ #define Schema_pg_type \ -{ 1247, {"typname"}, 19, -1, NAMEDATALEN, 1, 0, -1, -1, false, 'p', 'i', true, false, false, true, 0 }, \ +{ 1247, {"typname"}, 19, -1, NAMEDATALEN, 1, 0, -1, -1, false, 'p', 'c', true, false, false, true, 0 }, \ { 1247, {"typnamespace"}, 26, -1, 4, 2, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \ { 1247, {"typowner"}, 26, -1, 4, 3, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \ { 1247, {"typlen"}, 21, -1, 2, 4, 0, -1, -1, true, 'p', 's', true, false, false, true, 0 }, \ @@ -244,7 +244,7 @@ typedef FormData_pg_attribute *Form_pg_attribute; { 1247, {"typdefaultbin"}, 25, -1, -1, 25, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0 }, \ { 1247, {"typdefault"}, 25, -1, -1, 26, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0 } -DATA(insert ( 1247 typname 19 -1 NAMEDATALEN 1 0 -1 -1 f p i t f f t 0)); +DATA(insert ( 1247 typname 19 -1 NAMEDATALEN 1 0 -1 -1 f p c t f f t 0)); DATA(insert ( 1247 typnamespace 26 -1 4 2 0 -1 -1 t p i t f f t 0)); DATA(insert ( 1247 typowner 26 -1 4 3 0 -1 -1 t p i t f f t 0)); DATA(insert ( 1247 typlen 21 -1 2 4 0 -1 -1 t p s t f f t 0)); @@ -283,7 +283,7 @@ DATA(insert ( 1247 tableoid 26 0 4 -7 0 -1 -1 t p i t f f t 0)); * ---------------- */ #define Schema_pg_proc \ -{ 1255, {"proname"}, 19, -1, NAMEDATALEN, 1, 0, -1, -1, false, 'p', 'i', true, false, false, true, 0 }, \ +{ 1255, {"proname"}, 19, -1, NAMEDATALEN, 1, 0, -1, -1, false, 'p', 'c', true, false, false, true, 0 }, \ { 1255, {"pronamespace"}, 26, -1, 4, 2, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \ { 1255, {"proowner"}, 26, -1, 4, 3, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \ { 1255, {"prolang"}, 26, -1, 4, 4, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \ @@ -305,7 +305,7 @@ DATA(insert ( 1247 tableoid 26 0 4 -7 0 -1 -1 t p i t f f t 0)); { 1255, {"proconfig"}, 1009, -1, -1, 20, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0 }, \ { 1255, {"proacl"}, 1034, -1, -1, 21, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0 } -DATA(insert ( 1255 proname 19 -1 NAMEDATALEN 1 0 -1 -1 f p i t f f t 0)); +DATA(insert ( 1255 proname 19 -1 NAMEDATALEN 1 0 -1 -1 f p c t f f t 0)); DATA(insert ( 1255 pronamespace 26 -1 4 2 0 -1 -1 t p i t f f t 0)); DATA(insert ( 1255 proowner 26 -1 4 3 0 -1 -1 t p i t f f t 0)); DATA(insert ( 1255 prolang 26 -1 4 4 0 -1 -1 t p i t f f t 0)); @@ -340,7 +340,7 @@ DATA(insert ( 1255 tableoid 26 0 4 -7 0 -1 -1 t p i t f f t 0)); */ #define Schema_pg_attribute \ { 1249, {"attrelid"}, 26, -1, 4, 1, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \ -{ 1249, {"attname"}, 19, -1, NAMEDATALEN, 2, 0, -1, -1, false, 'p', 'i', true, false, false, true, 0 }, \ +{ 1249, {"attname"}, 19, -1, NAMEDATALEN, 2, 0, -1, -1, false, 'p', 'c', true, false, false, true, 0 }, \ { 1249, {"atttypid"}, 26, -1, 4, 3, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \ { 1249, {"attstattarget"}, 23, -1, 4, 4, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \ { 1249, {"attlen"}, 21, -1, 2, 5, 0, -1, -1, true, 'p', 's', true, false, false, true, 0 }, \ @@ -358,7 +358,7 @@ DATA(insert ( 1255 tableoid 26 0 4 -7 0 -1 -1 t p i t f f t 0)); { 1249, {"attinhcount"}, 23, -1, 4, 17, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 } DATA(insert ( 1249 attrelid 26 -1 4 1 0 -1 -1 t p i t f f t 0)); -DATA(insert ( 1249 attname 19 -1 NAMEDATALEN 2 0 -1 -1 f p i t f f t 0)); +DATA(insert ( 1249 attname 19 -1 NAMEDATALEN 2 0 -1 -1 f p c t f f t 0)); DATA(insert ( 1249 atttypid 26 -1 4 3 0 -1 -1 t p i t f f t 0)); DATA(insert ( 1249 attstattarget 23 -1 4 4 0 -1 -1 t p i t f f t 0)); DATA(insert ( 1249 attlen 21 -1 2 5 0 -1 -1 t p s t f f t 0)); @@ -387,7 +387,7 @@ DATA(insert ( 1249 tableoid 26 0 4 -7 0 -1 -1 t p i t f f t 0)); * ---------------- */ #define Schema_pg_class \ -{ 1259, {"relname"}, 19, -1, NAMEDATALEN, 1, 0, -1, -1, false, 'p', 'i', true, false, false, true, 0 }, \ +{ 1259, {"relname"}, 19, -1, NAMEDATALEN, 1, 0, -1, -1, false, 'p', 'c', true, false, false, true, 0 }, \ { 1259, {"relnamespace"}, 26, -1, 4, 2, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \ { 1259, {"reltype"}, 26, -1, 4, 3, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \ { 1259, {"relowner"}, 26, -1, 4, 4, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \ @@ -415,7 +415,7 @@ DATA(insert ( 1249 tableoid 26 0 4 -7 0 -1 -1 t p i t f f t 0)); { 1259, {"relacl"}, 1034, -1, -1, 26, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0 }, \ { 1259, {"reloptions"}, 1009, -1, -1, 27, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0 } -DATA(insert ( 1259 relname 19 -1 NAMEDATALEN 1 0 -1 -1 f p i t f f t 0)); +DATA(insert ( 1259 relname 19 -1 NAMEDATALEN 1 0 -1 -1 f p c t f f t 0)); DATA(insert ( 1259 relnamespace 26 -1 4 2 0 -1 -1 t p i t f f t 0)); DATA(insert ( 1259 reltype 26 -1 4 3 0 -1 -1 t p i t f f t 0)); DATA(insert ( 1259 relowner 26 -1 4 4 0 -1 -1 t p i t f f t 0)); diff --git a/src/include/catalog/pg_opclass.h b/src/include/catalog/pg_opclass.h index 13f66c01baf9b41e96988011a3267bd4103aa032..f0cb23e27085e9957087f7c511b77cdfe69d63a5 100644 --- a/src/include/catalog/pg_opclass.h +++ b/src/include/catalog/pg_opclass.h @@ -28,7 +28,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_opclass.h,v 1.81 2008/05/27 00:13:09 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_opclass.h,v 1.82 2008/06/24 17:58:27 tgl Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -121,8 +121,15 @@ DATA(insert ( 403 interval_ops PGNSP PGUID 1982 1186 t 0 )); DATA(insert ( 405 interval_ops PGNSP PGUID 1983 1186 t 0 )); DATA(insert ( 403 macaddr_ops PGNSP PGUID 1984 829 t 0 )); DATA(insert ( 405 macaddr_ops PGNSP PGUID 1985 829 t 0 )); -DATA(insert ( 403 name_ops PGNSP PGUID 1986 19 t 0 )); -DATA(insert ( 405 name_ops PGNSP PGUID 1987 19 t 0 )); +/* + * Here's an ugly little hack to save space in the system catalog indexes. + * btree and hash don't ordinarily allow a storage type different from input + * type; but cstring and name are the same thing except for trailing padding, + * and we can safely omit that within an index entry. So we declare the + * opclasses for name as using cstring storage type. + */ +DATA(insert ( 403 name_ops PGNSP PGUID 1986 19 t 2275 )); +DATA(insert ( 405 name_ops PGNSP PGUID 1987 19 t 2275 )); DATA(insert ( 403 numeric_ops PGNSP PGUID 1988 1700 t 0 )); DATA(insert ( 405 numeric_ops PGNSP PGUID 1998 1700 t 0 )); DATA(insert OID = 1981 ( 403 oid_ops PGNSP PGUID 1989 26 t 0 )); diff --git a/src/include/catalog/pg_type.h b/src/include/catalog/pg_type.h index 5687332e2a90c5e1d07416bb8a53eaebee089507..82798a7951e467f434d80243485ee2c15d64d8d8 100644 --- a/src/include/catalog/pg_type.h +++ b/src/include/catalog/pg_type.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_type.h,v 1.195 2008/04/21 00:26:47 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_type.h,v 1.196 2008/06/24 17:58:27 tgl Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -267,7 +267,7 @@ DATA(insert OID = 18 ( char PGNSP PGUID 1 t b t \054 0 0 1002 charin charout DESCR("single character"); #define CHAROID 18 -DATA(insert OID = 19 ( name PGNSP PGUID NAMEDATALEN f b t \054 0 18 1003 namein nameout namerecv namesend - - - i p f 0 -1 0 _null_ _null_ )); +DATA(insert OID = 19 ( name PGNSP PGUID NAMEDATALEN f b t \054 0 18 1003 namein nameout namerecv namesend - - - c p f 0 -1 0 _null_ _null_ )); DESCR("63-character type for storing system identifiers"); #define NAMEOID 19 diff --git a/src/include/pg_config_manual.h b/src/include/pg_config_manual.h index b56902d6fab94b424634d7b2d143317d7f59a445..3ee0d6d91b6c4a74aeb3326696bca796982e2bce 100644 --- a/src/include/pg_config_manual.h +++ b/src/include/pg_config_manual.h @@ -6,14 +6,14 @@ * for developers. If you edit any of these, be sure to do a *full* * rebuild (and an initdb if noted). * - * $PostgreSQL: pgsql/src/include/pg_config_manual.h,v 1.33 2008/05/02 19:52:37 tgl Exp $ + * $PostgreSQL: pgsql/src/include/pg_config_manual.h,v 1.34 2008/06/24 17:58:27 tgl Exp $ *------------------------------------------------------------------------ */ /* * Maximum length for identifiers (e.g. table names, column names, - * function names). It must be a multiple of sizeof(int) (typically - * 4). + * function names). Names actually are limited to one less byte than this, + * because the length must include a trailing zero byte. * * Changing this requires an initdb. */