Model Auto Increment Number Issue.. After 1000 Records

Hi All,

Please help me to fix this issue as i am getting it from today morning… After doing some research i have found the issue…

I have a table called… fmb_form_item_answer… [size="2"]in this table i now have records of 1079… the Model name is… [/size][size="2"]FmbFormItemAnswer[/size]

the issue is, after 999 is reached… when i access model->id it gives a text instead of int…

for example…

when when model->id = [size="2"]1079, it generates… 1,079 (with [/size]comma[size="2"] after 1)[/size]

I was able to figure this out after checking the DB logs… below is what i found…

2013-08-19 18:59:53 EST ERROR: invalid input syntax for integer: "1,079"

2013-08-19 18:59:53 EST STATEMENT: SELECT * FROM "fmb_form_item_answer" WHERE submission_id=$1

please can some expert help me to resolve this issue. its a coming up from a production server…

i tried… this way too… setting a rule in model… array(‘id’, ‘numerical’),

what is a data type of this field.have you checked your database table for it.Is something wrong there.

Hi tnx for quick reply…

its, [size="2"] id bigserial NOT NULL,[/size]

[size="2"]below is the table…[/size]




CREATE TABLE fmb_form_submission

(

  id bigserial NOT NULL,

  form_id bigint NOT NULL,

  date_added timestamp without time zone NOT NULL DEFAULT now(),

  CONSTRAINT pk_fmb_form_submission PRIMARY KEY (id ),

  CONSTRAINT fk_fmb_form_submission_fmb_form FOREIGN KEY (form_id)

      REFERENCES fmb_form (id) MATCH SIMPLE

      ON UPDATE NO ACTION ON DELETE NO ACTION

)

And in the model its defined as…




	/**

	 * @return array validation rules for model attributes.

	 */

	public function rules()

	{

		return array(

          array('id', 'numerical'),

		);

	}

Is your database is mysql or PostgreSql ??

I think you can give a try by changing this bigserial to int or big int.

Is it possible you’ve got a formatter somewhere in between?

No formatters used anywhere… The Database is [color=#1C2837][size=2]PostgreSql… :/[/size][/color]

[color=#1C2837][size=2]

[/size][/color]

[color=#1C2837][size=2]Any help pls[/size][/color]

This is not something with the Database type i think… because when i manually run the query this way i still get the error due to the 4 digit number…

SELECT * FROM “fmb_form_item_answer” WHERE submission_id=‘1,079’

but when i execute it without the comman, like following it works.

SELECT * FROM “fmb_form_item_answer” WHERE submission_id=‘1079’

i couldnt understand whats causing the model->id to be as a comma separated number

i think PostgreSql have some bugs with bigserial datatype.check this.also as i am checking some forum threads they are also facing same problem with it.