I'm having some serious problems with symfony, Doctrine and
PostgreSQL. Here is the error that I've been fighting with for the
last couple of days:

SQLSTATE[25P02]: In failed sql transaction: 7 ERROR:  current
transaction is aborted, commands ignored until end of transaction
block. Failing Query: CREATE INDEX company_id ON sf_guard_user_profile
(company_id)

It happens after symfony doctrine:build-all and it seems to affect
every single non-primary foreign key (not just the ones related to
sfGuard). Turning the key to primary foreign fixes the problem but I
don't want it to be primary.

I can't think of any logical reason why this error would happen.
Generally there's nothing wrong with using a non-primary (not null)
foreign key. But Doctrine/Postgre seems to think there is.

I know PostgreSQL creates an index for every primary key. Since
turning the key also into primary seems to fix it, should I just
define an index for it? I've tried it but nothing changes.

The tables in schema.yml are in the order that Doctrine put them from
my initial sketch database. Here are the relevant parts:

sfGuardUserProfile:
  tableName: sf_guard_user_profile
  actAs:
    Timestampable: ~
  columns:
    id:
      type: integer(8)
      primary: true
      sequence: sf_guard_user_profile_id
    company_id:
      type: integer(8)
      notnull: true
  relations:
    Company:
      local: company_id
      foreign: company_id
      type: one

Company:
  tableName: company
  actAs:
    Timestampable: ~
  columns:
    company_id:
      type: integer(4)
      primary: true
      sequence: company_company_id
  relations:
    sfGuardUserProfile:
      local: company_id
      foreign: company_id
      type: many

And the SQL:
CREATE TABLE sf_guard_user_profile (id BIGINT, company_id BIGINT NOT
NULL, PRIMARY KEY(id));
CREATE TABLE company (company_id INT, PRIMARY KEY(company_id));

Any ideas on how to fix this?
Thank you,
janneaa

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to