#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2001
    Posts
    1
    Rep Power
    0

    Angry 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
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 1999
    Location
    New York City
    Posts
    69
    Rep Power
    16
    Try making the datatype SERIAL!
    -------------------------
    The new search engine in town:
    http://www.w3matter.com
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Posts
    1
    Rep Power
    0

    Re: Creating autonumbers in postgres


    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.

IMN logo majestic logo threadwatch logo seochat tools logo