in reply to Problem with Class::DBI's create

Postgres, unless I am terribly mistaken, uses sequences to generate IDs. Class::DBI requires that you identify the sequences, if used.

$class->sequence( $sequence_name );

For your code, that should probably be something like the following in your base class:

Gallery::Image->sequence('gallery_images_id_seq');

I also see that you're calling $class->commit without calling $class->dbi_commit. If you have transactions enabled, you'll have to call the latter after the former as the commit() method has nothing to do with committing a transaction. You may wish to read the docs about this issue. It's been a source of confusion here at work (and I stills screw it up).

Cheers,
Ovid

New address of my CGI Course.
Silence is Evil (feel free to copy and distribute widely - note copyright text)

Replies are listed 'Best First'.
Re: Re: Problem with Class::DBI's create
by Molt (Chaplain) on Jan 15, 2003 at 22:47 UTC

    Thanks, it was the dbi_commit which was the issue. Didn't think it could be that since I had tried autocommit, and also since the docs said that the DESTROY method of Class::DBI would warn if the program exited with uncommited changes.

    Only goes to show you can't believe everything you read.