Jump to:

4945 Posts in 17703 Topics by 1494 members

Installing SilverStripe

SilverStripe Forums » Installing SilverStripe » Installing 3.0 on Postgres fails on database creation

Getting SilverStripe up and running on your computer and on your web server.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 436 Views
  • rturja
    Avatar
    Community Member
    4 Posts

    Installing 3.0 on Postgres fails on database creation Link to this post

    When installing a fresh SS on my server, the installation process stops after database is created on population stage - no tables are set up. My Postgres is version 8.4, Apache 2.2 with php 5.3.14 module running on top of FreeBSD. The exact same error happens with both trunk and stable versions of SS postgres connector.

    The failure occurs at

    •pg_query(Resource id #3646,CREATE TABLE "Email_BounceRecord" ( "ID" serial8 not null, "ClassName" varchar(255) default 'Email_BounceRecord' check ("ClassName" in ('Email_BounceRecord')), "Created" timestamp, "LastEdited" timestamp, "BounceEmail" varchar(50), "BounceTime" timestamp, "BounceMessage" varchar(50), "MemberID" integer default 0, primary key ("ID") ); create index ix_Email_BounceRecord_MemberID ON "Email_BounceRecord" (""MemberID""); create index ix_Email_BounceRecord_ClassName ON "Email_BounceRecord" (""ClassName""); )
    PostgreSQLDatabase.php:209
    •PostgreSQLDatabase->query(CREATE TABLE "Email_BounceRecord" ( "ID" serial8 not null, "ClassName" varchar(255) default 'Email_BounceRecord' check ("ClassName" in ('Email_BounceRecord')), "Created" timestamp, "LastEdited" timestamp, "BounceEmail" varchar(50), "BounceTime" timestamp, "BounceMessage" varchar(50), "MemberID" integer default 0, primary key ("ID") ); create index ix_Email_BounceRecord_MemberID ON "Email_BounceRecord" (""MemberID""); create index ix_Email_BounceRecord_ClassName ON "Email_BounceRecord" (""ClassName""); )
    PostgreSQLDatabase.php:360
    •PostgreSQLDatabase->createTable(Email_BounceRecord,Array,Array,Array,) Database.php:210
    •SS_Database->endSchemaUpdate() DatabaseAdmin.php:213
    •DatabaseAdmin->doBuild(,1) DatabaseAdmin.php:102

    The actual error seems to be double "s inserted in the query somewhere in the builder resulting in double delimetering the text. As I'm more of a server than php guy, any idea where and how to correct the seemingly malformed query?

  • rturja
    Avatar
    Community Member
    4 Posts

    Re: Installing 3.0 on Postgres fails on database creation Link to this post

    Okay... this is probably not the most stylish way to correct the issue, but...

    substituting line 459 of PostgreSQLDatabase.php

    $this->createOrReplacePartition($tableName, $extensions['partitions'],$indexes, $extensions);


    with this

    $this->createOrReplacePartition($tableName, $extensions['partitions'], str_replace("\"\"","\"",$indexes), $extensions);

    and modifying this block starting at line 447:

    $this->query("CREATE TABLE \"$tableName\" (
    $fieldSchemas
    $fulltexts
    primary key (\"ID\")
    )$tableSpace; $indexSchemas; $addOptions");


    with this

    $fixindex=str_replace("\"\"","\"",$indexSchemas);
    $this->query("CREATE TABLE \"$tableName\" (
    $fieldSchemas
    $fulltexts
    primary key (\"ID\")
    )$tableSpace; $fixindex; $addOptions");

    made the install complete without errors for me

    436 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.