Subject RE: [firebird-support] Error while attempting to add a Primary key to a table that has no records
Author stwizard
Hmmm,



I tried again this evening and it would allow me to add the primary key. Very strange. Since we moved to a new windows server 2012 R2 and upgraded to v2.5.4 firebird running Classic Super Server from v1.5.4 running Classic Server, could any of that have anything to do with it? Could the fact that everyone was logged into Firebird have anything to do with it? The only user that would have ever used this table was logged out and gone home for the day or I would have never attempted to do it during the day. There was still one user logged in that must of forgot to log out and it let me add the PK now?



Would be interested in anyone’s thoughts,



Mike



From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com]
Sent: Thursday, October 01, 2015 4:04 PM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Error while attempting to add a Primary key to a table that has no records



Greetings,

Firebird v2.5.4

I use Database Workbench v 5 as my database development tool.

I have this table which is currently empty (0 rows). It originally had a primary key on TRUST_STATEMENT_ID and ORIGINAL_PMT_ID

CREATE TABLE TRUST_STATEMENT_PMT_BACKOUT_CHK

(

TRUST_STATEMENT_ID INTEGER NOT NULL,

ORIGINAL_PMT_ID INTEGER NOT NULL,

ORIGINAL_ACCT_ID INTEGER NOT NULL,

ORIGINAL_CASE_ID SMALLINT NOT NULL,

ORIGINAL_DEBT_NO SMALLINT NOT NULL,

ORIGINAL_PMT_NO SMALLINT NOT NULL,

ORIGINAL_PMT_DATE DATE NOT NULL,

ORIGINAL_PMT_AMT NUMERIC( 15, 2) NOT NULL,

BACKOUT_PMT_ID INTEGER,

BACKOUT_PMT_NO SMALLINT,

BACKOUT_PMT_DATE DATE,

BACKOUT_PMT_AMT NUMERIC( 15, 2)

);

I drop the PK so I could add 3 new fields (ORIGINAL_ACCT_ID, ORIGINAL_CASE_ID and ORIGINAL_DEBT_NO) to this table.

Now I’m trying to add a primary key on TRUST_STATEMENT_ID, ORIGINAL_PMT_ID, ORIGINAL_ACCT_ID, ORIGINAL_CASE_ID and ORIGINAL_DEBT_NO

But I receive this error:

validation error for column ORIGINAL_ACCT_ID, value "*** null ***"

while executing:

ALTER TABLE TRUST_STATEMENT_PMT_BACKOUT_CHK

ADD CONSTRAINT PK_TRUST_STATEMENT_PMT_BACK PRIMARY KEY (TRUST_STATEMENT_ID, ORIGINAL_PMT_ID, ORIGINAL_ACCT_ID, ORIGINAL_CASE_ID, ORIGINAL_DEBT_NO)

Why am I receiving this error and how do I fix it?

Mike





[Non-text portions of this message have been removed]