Primary keys additional

Started by J.M.almost 27 years ago2 messages
#1J.M.
darcy@druid.net

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.
#2J.M.
darcy@druid.net
In reply to: J.M. (#1)
Re: [HACKERS] Primary keys additional

Thus spake D'Arcy J.M. Cain

My changes for primary key support weren't quite right. This change
completes the job.

Doh! Sorry. I subscribed to pgsql-patches so I could post there then
I forgot. Sorry about that. I'll repost.

-- 
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.