[Maypole] table constraints and ContextualFetch.pm

Jim Blomo jim@xcf.berkeley.edu
Sat, 14 Aug 2004 12:06:56 -0700


--FCuugMFkClbJLl1L
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi all,

I'm using Maypole with postgres 7.4.  So far its working great with the
beer example.  I've added some of my own tables, specifically one with
the Foreign-key constraint: "$1" FOREIGN KEY (category) REFERENCES category(id).
When I try to use the do_edit method, though, I get the failure:

DBD::Pg::st execute failed: ERROR:  insert or update on table "example" violates
foreign key constraint "$1" [for Statement "INSERT INTO example (email, summary,
worth, id, description)
VALUES (?, ?, ?, ?, ?)
"] at /usr/local/lib/perl5/site_perl/5.8.5/DBIx/ContextualFetch.pm line 51.
[Sat Aug 14 18:53:06 2004] [error] Can't insert new Hookups::Hookup: DBD::Pg::st
execute failed: ERROR:  insert or update on table "example" violates foreign key
constraint "$1" [for Statement "INSERT INTO example (email, summary, worth, id,
description)\nVALUES (?, ?, ?, ?, ?)\n"] at
/usr/local/lib/perl5/site_perl/5.8.5/DBIx/ContextualFetch.pm line 51.\n at
/usr/local/lib/perl5/site_perl/5.8.5/Class/DBI/FromCGI.pm line 246\n

I have this relationship specified in the BeerDB class: 'a category has
examples'.  The row is being displayed correctly as a drop down lists
with options from the category table.  Is the update of a row a two step
process?  Is there a way to keep constraints specified in postgres as
well as Maypole?

Thanks,

Jim

--FCuugMFkClbJLl1L
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)

iD8DBQFBHmLQAeSVs8eUE7kRApZNAJ9/7oqKzprJ4+FJ8KbQRi2S/XSahACeOBZ9
PK8xJmHlZLBi5ekSJNXYlY4=
=9sSy
-----END PGP SIGNATURE-----

--FCuugMFkClbJLl1L--