Helpful Information
 
 
Category: PostgreSQL Help
Creating autonumbers in postgres

Does anyone know how to create an autonumber in postgres? I have two primary keys and one of which is supposed to be a autonumber. I have ported this db over from access and I have cold fusion insert and update forms that work with the access version. I have one of the forms for one of my tables that has 1 primary key, that is not a autonumber, working in postgres but the table with the 2 keys, one of which is autonumber, keeps giving me this message: ODBC Error Code = S1000 (General error)
Error while executing the query; ERROR: ExecAppend: Fail to add null value in not null attribute order_id. When I was getting this error that field was not even on the form in because I assumed it was being generated, I realized it was passing a null value and added it to the form so the user has to input it, but now i am getting that little grey box that says illegal operation program will shut down. Does anyone know how to fix this or at least how to create an autonumber because thats all I can think of?
Thanks

Try making the datatype SERIAL!

Originally posted by vio
Does anyone know how to create an autonumber in postgres? I have two primary keys and one of which is supposed to be a autonumber. I have ported this db over from access and I have cold fusion insert and update forms that work with the access version. I have one of the forms for one of my tables that has 1 primary key, that is not a autonumber, working in postgres but the table with the 2 keys, one of which is autonumber, keeps giving me this message: ODBC Error Code = S1000 (General error)
Error while executing the query; ERROR: ExecAppend: Fail to add null value in not null attribute order_id. When I was getting this error that field was not even on the form in because I assumed it was being generated, I realized it was passing a null value and added it to the form so the user has to input it, but now i am getting that little grey box that says illegal operation program will shut down. Does anyone know how to fix this or at least how to create an autonumber because thats all I can think of?
Thanks

Use triggers.










privacy (GDPR)