Skip site navigation (1) Skip section navigation (2)

Primary keys additional

From: "D'Arcy" "J(dot)M(dot)" Cain <darcy(at)druid(dot)net>
To: pgsql-hackers(at)PostgreSQL(dot)org
Subject: Primary keys additional
Date: 1999-01-26 13:44:56
Message-ID: m1058nY-0000bnC@druid.net (view raw or flat)
Thread:
Lists: 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(at){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.

Responses

pgsql-hackers by date

Next:From: D'Arcy J.M. CainDate: 1999-01-26 14:12:46
Subject: Re: [HACKERS] Primary keys additional
Previous:From: Oleg BroytmannDate: 1999-01-26 10:51:05
Subject: Re: [HACKERS] Re: datetime regress test busted by incomplete checkin

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group