Primary keys additional - Mailing list pgsql-hackers

From D'Arcy" "J.M." Cain
Subject Primary keys additional
Date
Msg-id m1058nY-0000bnC@druid.net
Whole thread Raw
Responses Re: [HACKERS] Primary keys additional  ("D'Arcy" "J.M." Cain <darcy@druid.net>)
List pgsql-hackers
My changes for primary key support weren't quite right.  This change
completes the job.

*** ../src.original/./backend/parser/analyze.c    Mon Jan 25 23:44:26 1999
--- ./backend/parser/analyze.c    Tue Jan 26 08:39:05 1999
***************
*** 714,719 ****
--- 714,720 ----         index = makeNode(IndexStmt);          index->unique = TRUE;
+         index->primary = (constraint->contype == CONSTR_PRIMARY ? TRUE:FALSE);         if (constraint->name != NULL)
          index->idxname = constraint->name;         else if (constraint->contype == CONSTR_PRIMARY)
 
***************
*** 722,735 ****                 elog(ERROR, "CREATE TABLE/PRIMARY KEY multiple keys for table %s are not legal",
stmt->relname);             have_pkey = TRUE;
 
-             index->primary = TRUE;             index->idxname = makeTableName(stmt->relname, "pkey", NULL);         }
       else
 
-         {
-             index->primary = FALSE;             index->idxname = NULL;
-         }          index->relname = stmt->relname;         index->accessMethod = "btree";
--- 723,732 ----
*** ../src.original/./backend/tcop/utility.c    Mon Jan 25 23:40:17 1999
--- ./backend/tcop/utility.c    Mon Jan 25 23:40:34 1999
***************
*** 404,410 ****                             stmt->indexParams,    /* parameters */
stmt->withClause,                            stmt->unique,
 
!                             0,        /* CREATE INDEX can't be primary */                             (Expr *)
stmt->whereClause,                            stmt->rangetable);             }
 
--- 404,410 ----                             stmt->indexParams,    /* parameters */
stmt->withClause,                            stmt->unique,
 
!                             stmt->primary,                             (Expr *) stmt->whereClause,
        stmt->rangetable);             }
 

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 424 2871     (DoD#0082)    (eNTP)   |  what's for dinner.


pgsql-hackers by date:

Previous
From: Vadim Mikheev
Date:
Subject: Re: [HACKERS] Major breakage?
Next
From: "D'Arcy" "J.M." Cain
Date:
Subject: Re: [HACKERS] Primary keys additional