Subject Re: [firebird-support] Error while attempting to add a Primary key to a table that has no records
Author Thomas Steinmaurer
> 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?

Any chance that at some point the new fields have not been declared as NOT NULL? I see they are in your final table DDL below, but perhaps they have been added as NULLable in a first try?



--
With regards,
Thomas Steinmaurer
http://www.upscene.com

Professional Tools and Services for Firebird
FB TraceManager, IB LogManager, Database Health Check, Tuning etc.




>
>
>
> 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]
>
>
>
> ------------------------------------
> Posted by: "stwizard" <stwizard@...>
> ------------------------------------
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://www.firebirdsql.org and click the Documentation item
> on the main (top) menu. Try FAQ and other links from the left-side menu there.
>
> Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> ------------------------------------
>
> Yahoo Groups Links
>
>
>