Search Postgresql Archives

Re: I'm puzzled by a foreign key constraint problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jonathan Guthrie wrote:
> When I create a project, entries in the project table and the resource
> table are created in a single function.  Then, separate functions are
> called to set the owner's access to the new project.  These other
> functions are failing because of the resourceid foreign key constraint.

Have you turned statement logging on? Your message suggests that's the
case, but didn't say so explicitly.

Are the two steps:
  1. Create project, resource
  2. Set access-rights
done in separate connections by any chance? If so it's possible (due to
MVCC) that #2 is still seeing the database as it was before #1 committed.

> Anyway, I need for these operations to succeed because the lack of
> permissions causes odd problems in other parts of the system.

If you want both steps to succeed or fail together though, they need to
be in the same transaction.

-- 
  Richard Huxton
  Archonet Ltd

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux