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

Re: how to create secondary key!!

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: "Nelson Yong" <nelsonyong(at)ipmuda(dot)com(dot)my>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: how to create secondary key!!
Date: 2002-10-28 01:13:30
Message-ID: web-1801250@davinci.ethosmedia.com (view raw or flat)
Thread:
Lists: pgsql-novice
Nelson,

> I appriciate u reply, thank u.
> 
> I try the sql statement which u commented then how to solve not null 
> problem.  
> 
> ALTER TABLE king ADD CONSTRAINT king_PK
> PRIMARY KEY (vb1, vb2);
> 
> Error hit during execute this command
> Number: -2147467259
> 
> Description: Error while executing the query;
> ERROR:  Existing attribute "vb1" cannot be a PRIMARY KEY because it
> is 
> not marked NOT NULL
> ---------------------------
> OK   
> ---------------------------
> 
> i try to use command below but no function, kindly command.
> 
> ALTER TABLE table_name
>    ALTER COLUMN column_name INT NOT NULL 

Regrettably, this function of the ALTER TABLE command is currently not
supported in PostgreSQL.   In order to mark a column as NOT NULL, you
must:
1) make sure to remove all NULLs from the column, and 
2) modify the system tables to set the column NOT NULL.

Hopefully someone will post more detailed instructions on step 2), as I
cannot remember them right now.

-Josh




pgsql-novice by date

Next:From: Sigurdur HelgasonDate: 2002-10-28 08:30:10
Subject: How to dynamically call a column in plpgsql
Previous:From: Peter GalbavyDate: 2002-10-26 11:26:58
Subject: Re: pg or DBI

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