Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Installing SilverStripe

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

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

PostgreSQL bug in trunk


Reply

3 Posts   710 Views

Avatar
zmeuka

16 November 2010 at 4:55pm Community Member, 3 Posts

I have downloaded postgresql-trunk-r113659.tar.gz - but after fresh SilverStripe install the Admin interface was almost dead.
The problem is under "todo" in PostgreSQLDatabase.php:

Actual PG Constraint string:

CHECK ("ClassName"::text = 'SiteTree'::text OR "ClassName"::text = 'Page'::text
OR "ClassName"::text = 'ErrorPage'::text OR "ClassName"::text = 'RedirectorPage'::text
OR "ClassName"::text = 'VirtualPage'::text)

Code from trunk (as you can see there's no chances to get classes from constraint above):

private function EnumValuesFromConstraint($constraint){
$constraint=substr($constraint, strpos($constraint, 'ANY (ARRAY[')+11);
$constraint=substr($constraint, 0, -11);
$constraints=Array();
$segments=explode(',', $constraint);
foreach($segments as $this_segment){
$bits=preg_split('/ *:: * /', $this_segment);
array_unshift($constraints, trim($bits[0], " '"));
}
return $constraints;
}

   

My replacement - working - code:

private function EnumValuesFromConstraint($constraint){
$matches = Array();
$constraints = Array();
if (preg_match_all("/\'(\w+)\'\:\:text/",$constraint,$matches)) {
$constraints = $matches[1];
}
return $constraints;
}

Avatar
Sean

16 November 2010 at 7:37pm Forum Moderator, 921 Posts

Hi zmeuka,

I couldn't replicate this. Where abouts were you having issues?

I'm using PostgreSQL 8.3.12, SilverStripe 2.4 check out from http://svn.silverstripe.com/open/phpinstaller/branches/2.4 @ revision 113808 and postgresql module @ revision r113659.

Sean

Avatar
zmeuka

16 November 2010 at 10:55pm (Last edited: 16 November 2010 10:56pm), Community Member, 3 Posts

SilverStripe 2.4.3 (stable download) and same PostgreSQL module from SVN.
Admin Interface dies after fresh install with error about bad class name in singleton (singleton called with class name = 'ssName"').
Maybe the constraint syntax in SS2.4/svn changed?