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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-novice by date

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