Postrgresql install error - looks like data definition problem.

Postrgresql install error - looks like data definition problem.

by Worth Bishop -
Number of replies: 3

On a fresh install of 1.5.2+ (2005060222) (Downloaded 7/25/05) during the database installation the following errors are returned (bold added):


(postgres7): CREATE TABLE sbx_grade_letter ( id SERIAL PRIMARY KEY, courseid integer NOT NULL default '0', letter varchar(8) NOT NULL default 'NA', grade_high decimal(4, 2) NOT NULL default '100.00', grade_low decimal(4, 2) NOT NULL default '0.00')  


-1: ERROR: overflow on numeric ABS(value) >= 10^2 for field with precision 4 scale 2

      
   


Error


(postgres7): CREATE INDEX sbx_grade_letter_courseid_idx ON sbx_grade_letter (courseid)  


-18: ERROR: Relation "sbx_grade_letter" does not exist

      
   


Error


Running postgresql 7.4 here...

Can I fix or download another release?

Thanks,

WB

Average of ratings: -
In reply to Worth Bishop

Re: Postrgresql install error - looks like data definition problem - figured fix, I think?.

by Worth Bishop -
Believe the correction here should be to change:

(postgres7): CREATE TABLE sbx_grade_letter ( id SERIAL PRIMARY KEY, courseid integer NOT NULL default '0', letter varchar(8) NOT NULL default 'NA', grade_high decimal(4, 2) NOT NULL default '100.00', grade_low decimal(4, 2) NOT NULL default '0.00')

To:

(postgres7): CREATE TABLE sbx_grade_letter ( id SERIAL PRIMARY KEY, courseid integer NOT NULL default '0', letter varchar(8) NOT NULL default 'NA', grade_high decimal(6, 2) NOT NULL default '100.00', grade_low decimal(6, 2) NOT NULL default '0.00')

In PostgreSQL, in using the decimal (alias numeric) data type, "The precision is the maximum number of sequential digits that the numeric value may hold (including digits to the right of the decimal point), while the scale describes how many of those digits of precision are to be to the right of the decimal point. If left unspecified, the precision will default to 30, and the scale will default to 6.

Since 100.00 is more than 4 digits, this CREATE statement throws an over flow error.

Believe these statements are in both /lib/db/postgres7.php and /lib/db/postgres7.sql but I'm not entirely certain.

Hope we can get a fix in a near-term release...

Thanks,

WB


In reply to Worth Bishop

Re: Postrgresql install error - looks like data definition problem.

by Patrick Li -
The fix is commited to CVS and will probably be in the next release.
For the time being, open file lib/db/postgres7.sql and search for:

grade_high decimal(4,2) NOT NULL default '100.00',
grade_low decimal(4,2) NOT NULL default '0.00'

and replace with:

grade_high decimal(6,2) NOT NULL default '100.00',
grade_low decimal(6,2) NOT NULL default '0.00'

Then do a fresh install.
In reply to Patrick Li

Re: Postrgresql install error - looks like data definition problem.

by Worth Bishop -

Thank you, Patrick!

I