RE: System indexes are never unique indexes( was RE: [HACKERS] mdnblocksis - Mailing list pgsql-hackers
| From | Hiroshi Inoue |
|---|---|
| Subject | RE: System indexes are never unique indexes( was RE: [HACKERS] mdnblocksis |
| Date | |
| Msg-id | 000401bf2060$0d08e820$2801007e@cadzone.tpf.co.jp Whole thread Raw |
| In response to | Re: System indexes are never unique indexes( was RE: [HACKERS] mdnblocksis (Bruce Momjian <maillist@candle.pha.pa.us>) |
| Responses |
Re: System indexes are never unique indexes( was RE: [HACKERS] mdnblocksis
|
| List | pgsql-hackers |
> >
> > Anyway,I want to change the implementation of mdcreate() to reuse
> > existent files but the uniqueness of table name is preserved by the
> > current implementation narrowly.
> >
> > First of all,I would change pg_type,pg_class.
> > It's OK ?
>
> Sure.
>
I made a patch.
But I'm not sure my solution is right.
Is there a better way ?
Regards.
Hiroshi Inoue
Inoue@tpf.co.jp
*** ../../head/pgcurrent/backend/bootstrap/bootscanner.l Tue Sep 14
12:17:34 1999
--- backend/bootstrap/bootscanner.l Tue Oct 26 23:36:08 1999
***************
*** 90,95 ****
--- 90,96 ---- "declare" { return(XDECLARE); } "build" { return(XBUILD); } "indices" {
return(INDICES);}
+ "unique" { return(UNIQUE); } "index" { return(INDEX); } "on" { return(ON); } "using"
{ return(USING); }
*** ../../head/pgcurrent/backend/bootstrap/bootparse.y Mon Jul 26 12:44:44
1999
--- backend/bootstrap/bootparse.y Tue Oct 26 23:47:20 1999
***************
*** 80,86 **** %token <ival> CONST ID %token OPEN XCLOSE XCREATE INSERT_TUPLE %token STRING XDEFINE
! %token XDECLARE INDEX ON USING XBUILD INDICES %token COMMA EQUALS LPAREN RPAREN %token OBJ_ID XBOOTSTRAP NULLVAL
%startTopLevel
--- 80,86 ---- %token <ival> CONST ID %token OPEN XCLOSE XCREATE INSERT_TUPLE %token STRING XDEFINE
! %token XDECLARE INDEX ON USING XBUILD INDICES UNIQUE %token COMMA EQUALS LPAREN RPAREN %token OBJ_ID XBOOTSTRAP
NULLVAL%start TopLevel
***************
*** 106,111 ****
--- 106,112 ---- | Boot_CreateStmt | Boot_InsertStmt | Boot_DeclareIndexStmt
+ | Boot_DeclareUniqueIndexStmt | Boot_BuildIndsStmt ;
***************
*** 226,231 ****
--- 227,245 ---- LexIDStr($3), LexIDStr($7),
$9, NIL, 0, 0, 0, NIL);
+ DO_END;
+ }
+ ;
+
+ Boot_DeclareUniqueIndexStmt:
+ XDECLARE UNIQUE INDEX boot_ident ON boot_ident USING boot_ident
LPAREN boot_index_params RPAREN
+ {
+ DO_START;
+
+ DefineIndex(LexIDStr($6),
+ LexIDStr($4),
+ LexIDStr($8),
+ $10, NIL, 1, 0, 0, NIL); DO_END; } ;
*** ../../head/pgcurrent/backend/catalog/genbki.sh.in Mon Jul 26 12:44:44
1999
--- backend/catalog/genbki.sh.in Tue Oct 26 22:03:43 1999
***************
*** 164,169 ****
--- 164,183 ---- print "declare index " data }
+ /^DECLARE_UNIQUE_INDEX\(/ {
+ # ----
+ # end any prior catalog data insertions before starting a define unique
index
+ # ----
+ if (reln_open == 1) {
+ # print "show";
+ print "close " catalog;
+ reln_open = 0;
+ }
+
+ data = substr($0, 22, length($0) - 22);
+ print "declare unique index " data
+ }
+ /^BUILD_INDICES/ { print "build indices"; }
# ----------------
*** ../../head/pgcurrent/include/postgres.h Mon Oct 25 22:13:13 1999
--- include/postgres.h Tue Oct 26 21:45:27 1999
***************
*** 138,143 ****
--- 138,144 ---- #define DATA(x) extern int errno #define DESCR(x) extern int errno #define DECLARE_INDEX(x) extern int
errno
+ #define DECLARE_UNIQUE_INDEX(x) extern int errno
#define BUILD_INDICES #define BOOTSTRAP
*** ../../head/pgcurrent/include/catalog/indexing.h Mon Oct 4 14:25:34
1999
--- include/catalog/indexing.h Tue Oct 26 21:47:24 1999
***************
*** 102,112 **** DECLARE_INDEX(pg_proc_oid_index on pg_proc using btree(oid oid_ops));
DECLARE_INDEX(pg_proc_proname_narg_type_indexon pg_proc using
btree(proname name_ops, pronargs int2_ops, proargtypes oid8_ops));
! DECLARE_INDEX(pg_type_oid_index on pg_type using btree(oid oid_ops));
! DECLARE_INDEX(pg_type_typname_index on pg_type using btree(typname
name_ops));
! DECLARE_INDEX(pg_class_oid_index on pg_class using btree(oid oid_ops));
! DECLARE_INDEX(pg_class_relname_index on pg_class using btree(relname
name_ops));
DECLARE_INDEX(pg_attrdef_adrelid_index on pg_attrdef using btree(adrelid
oid_ops));
--- 102,112 ---- DECLARE_INDEX(pg_proc_oid_index on pg_proc using btree(oid oid_ops));
DECLARE_INDEX(pg_proc_proname_narg_type_indexon pg_proc using
btree(proname name_ops, pronargs int2_ops, proargtypes oid8_ops));
! DECLARE_UNIQUE_INDEX(pg_type_oid_index on pg_type using btree(oid
oid_ops));
! DECLARE_UNIQUE_INDEX(pg_type_typname_index on pg_type using btree(typname
name_ops));
! DECLARE_UNIQUE_INDEX(pg_class_oid_index on pg_class using btree(oid
oid_ops));
! DECLARE_UNIQUE_INDEX(pg_class_relname_index on pg_class using
btree(relname name_ops));
DECLARE_INDEX(pg_attrdef_adrelid_index on pg_attrdef using btree(adrelid
oid_ops));
pgsql-hackers by date: