[GH-ISSUE #23] Table creation fails on PostgreSQL #21

Closed
opened 2026-02-26 09:35:13 +03:00 by kerem · 8 comments
Owner

Originally created by @nrosier on GitHub (Aug 28, 2012).
Original GitHub issue: https://github.com/opensolutions/ViMbAdmin/issues/23

Hi,

I'm trying to install ViMbAdmin with PostgreSQL but the table-creation fails:

./doctrine-cli.php create-tables

SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block. Failing Query: "ALTER TABLE alias ADD CONSTRAINT alias_domain_domain_domain FOREIGN KEY (domain) REFERENCES domain(domain) NOT DEFERRABLE INITIALLY IMMEDIATE". Failing Query: ALTER TABLE alias ADD CONSTRAINT alias_domain_domain_domain FOREIGN KEY (domain) REFERENCES domain(domain) NOT DEFERRABLE INITIALLY IMMEDIATE

Has anyone tested this before?
N.

Originally created by @nrosier on GitHub (Aug 28, 2012). Original GitHub issue: https://github.com/opensolutions/ViMbAdmin/issues/23 Hi, I'm trying to install ViMbAdmin with PostgreSQL but the table-creation fails: # ./doctrine-cli.php create-tables SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block. Failing Query: "ALTER TABLE alias ADD CONSTRAINT alias_domain_domain_domain FOREIGN KEY (domain) REFERENCES domain(domain) NOT DEFERRABLE INITIALLY IMMEDIATE". Failing Query: ALTER TABLE alias ADD CONSTRAINT alias_domain_domain_domain FOREIGN KEY (domain) REFERENCES domain(domain) NOT DEFERRABLE INITIALLY IMMEDIATE Has anyone tested this before? N.
kerem closed this issue 2026-02-26 09:35:13 +03:00
Author
Owner

@barryo commented on GitHub (Oct 10, 2012):

I haven't come across this before but we will push this to the next milestone and test with Doctrine 2.x

<!-- gh-comment-id:9293856 --> @barryo commented on GitHub (Oct 10, 2012): I haven't come across this before but we will push this to the next milestone and test with Doctrine 2.x
Author
Owner

@martintama commented on GitHub (Jun 6, 2013):

Any updates on this? I'm installing ViMbAdmin from the master branch, and the database initialization fails with the same error.

OS: Debian 7 Wheezy.
Database: PostgreSQL 9.1

Any help would be appreciated.

<!-- gh-comment-id:19066433 --> @martintama commented on GitHub (Jun 6, 2013): Any updates on this? I'm installing ViMbAdmin from the master branch, and the database initialization fails with the same error. OS: Debian 7 Wheezy. Database: PostgreSQL 9.1 Any help would be appreciated.
Author
Owner

@morfran commented on GitHub (Jul 7, 2013):

Since nobody seems to be terribly interested, you can move on from here by creating the database from the output of this command:

./doctrine-cli.php generate-sql

I also put a path into library/Doctrine/Doctrine/Task/GenerateSql.php so that I could pick up the output; In the execute function in that file:

    else {
        $path = '/tmp/vimbadmin.sql';
        #throw new Doctrine_Task_Exception('Invalid sql path.');
    }

You should then get the output for building your tables in the file /tmp/vimbadmin.sql

I ran it in psql and it worked, so I'm not sure what the issue is. I had to rename the domain index (to domain_idx) due to the table with the same name.

Output here:

http://pastebin.com/txKvfC7q

<!-- gh-comment-id:20577683 --> @morfran commented on GitHub (Jul 7, 2013): Since nobody seems to be terribly interested, you can move on from here by creating the database from the output of this command: ./doctrine-cli.php generate-sql I also put a path into library/Doctrine/Doctrine/Task/GenerateSql.php so that I could pick up the output; In the execute function in that file: ``` else { $path = '/tmp/vimbadmin.sql'; #throw new Doctrine_Task_Exception('Invalid sql path.'); } ``` You should then get the output for building your tables in the file /tmp/vimbadmin.sql I ran it in psql and it worked, so I'm not sure what the issue is. I had to rename the domain index (to domain_idx) due to the table with the same name. Output here: http://pastebin.com/txKvfC7q
Author
Owner

@dxtr commented on GitHub (Sep 7, 2013):

Yep. I just hit this issue too with the current (as in from today) master branch

@morfran's recommendations worked so far at least

<!-- gh-comment-id:23978361 --> @dxtr commented on GitHub (Sep 7, 2013): Yep. I just hit this issue too with the current (as in from today) master branch @morfran's recommendations worked so far at least
Author
Owner

@rootwyrm commented on GitHub (Oct 8, 2013):

Yep, hit it today myself.
doctrine-cli.php is spitting out a false error. The actual problem:
liam@scemail [32514] ERROR: relation "domain" already exists

Well, the problem is obvious - it's trying to create an INDEX with the same name as the table AND column. Obviously a no-no. What I can't figure out is why Doctrine is trying to create an index there - IOW, I think it's a Doctrine problem. What's more annoying is that adding explicit indexes in the YAML definition also doesn't fix it, even though it should.
Also worth noting, this is the only INDEX Doctrine attempts to create.

<!-- gh-comment-id:25928562 --> @rootwyrm commented on GitHub (Oct 8, 2013): Yep, hit it today myself. doctrine-cli.php is spitting out a false error. The actual problem: liam@scemail [32514] ERROR: relation "domain" already exists Well, the problem is obvious - it's trying to create an INDEX with the same name as the table AND column. Obviously a no-no. What I can't figure out is why Doctrine is trying to create an index there - IOW, I think it's a Doctrine problem. What's more annoying is that adding explicit indexes in the YAML definition also doesn't fix it, even though it should. Also worth noting, this is the only INDEX Doctrine attempts to create.
Author
Owner

@barryo commented on GitHub (Oct 9, 2013):

Nice work @rootwyrm - the good news is ViMbAdmin3 uses Doctrine2 and so should be immune from this issue.

<!-- gh-comment-id:25948868 --> @barryo commented on GitHub (Oct 9, 2013): Nice work @rootwyrm - the good news is ViMbAdmin3 uses Doctrine2 and so should be immune from this issue.
Author
Owner

@rootwyrm commented on GitHub (Oct 9, 2013):

One can hope; I haven't touched Doctrine2 so no idea. Obviously the optimal solution would be to create a proper set of indexes in the YAML, but I'm a PostgreSQL guy. No idea how they'd behave in MySQL, MariaDB or Percona. :(

<!-- gh-comment-id:25995126 --> @rootwyrm commented on GitHub (Oct 9, 2013): One can hope; I haven't touched Doctrine2 so no idea. Obviously the optimal solution would be to create a proper set of indexes in the YAML, but I'm a PostgreSQL guy. No idea how they'd behave in MySQL, MariaDB or Percona. :(
Author
Owner

@barryo commented on GitHub (Feb 15, 2014):

V3 is now released and using Doctrine2.

<!-- gh-comment-id:35151394 --> @barryo commented on GitHub (Feb 15, 2014): V3 is now released and using Doctrine2.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ViMbAdmin-opensolutions#21
No description provided.