[rt-devel] rt3.0.7_01 rt_setup_database fails w/postgres
Abraham Ingersoll
abe at dajoba.com
Wed Nov 26 19:02:35 EST 2003
Removing the BEGIN; at the head of schema.Pg and the COMMIT; at the end
of schema.Pg, and then adding Pg-conditional
$dbh->begin_work/$dbh->commit statements to rt-setup-database let me
work around this issue:
if ($RT::DatabaseType eq "Pg") {
$dbh->begin_work;
}
foreach my $statement (@schema) {
if ($statement =~ /^\s*;$/) { $is_local = 1; next; }
print STDERR "SQL: $statement\n" if defined $args{'debug'};
my $sth = $dbh->prepare($statement) or die $dbh->errstr;
unless ( $sth->execute or $is_local ) {
die "Problem with statement:\n $statement\n" .
$sth->errstr;
}
}
if ($RT::DatabaseType eq "Pg") {
$dbh->commit;
}
--Abe
On Wed, 2003-11-26 at 15:36, Abraham Ingersoll wrote:
> sbin/rt-setup-database from 3.0.7_01 dies when I try to initialize a
> postgresql database. From what I can tell, it's choking on the
> transaction "BEGIN" at the top of Pg.schema, but I didn't dig into
> rt-setup-database enough to be sure.
>
> rt-setup-database output (args{debug} on):
>
> [root at gimli rt-3-0-7_01]# make initialize-database
> /usr/bin/perl //home/abe/apache_perl/rt/sbin/rt-setup-database --action
> init --dba root --prompt-for-dba-password --debug
> In order to create a new database and grant RT access to that database,
> this script needs to connect to your Pg instance on localhost as root.
> Please specify that user's database password below. If the user has no
> database
> password, just press return.
>
> Password: Now creating a database for RT.
> Creating Pg database rt3.
> Now populating database schema.
> Creating database schema.
> SQL:
>
>
>
>
> BEGIN
> Died at //home/abe/apache_perl/rt/sbin/rt-setup-database line 161.
> make: *** [initialize-database] Error 2
>
>
> Importing the schema into postgres by hand seems to work:
>
> [root at gimli etc]# psql template1 -U root -W < schema.Pg
> Password:
> BEGIN
> CREATE SEQUENCE
> NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
> 'attachments_pkey
> ' for table 'attachments'
> CREATE TABLE
> CREATE INDEX
> CREATE INDEX
> [snip snip snip]
> CREATE INDEX
> NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
> 'sessions_pkey' f
> or table 'sessions'
> CREATE TABLE
> COMMIT
>
> My platform/environment:
> Redhat 9
> Postgresql 7.3.4 (postgresql-server-7.3.4-3.rhl9)
> perl-DBI version 1.38, DBD::Pg version 1.31
>
>
>
> --Abe
>
> _______________________________________________
> rt-devel mailing list
> rt-devel at lists.fsck.com
> http://lists.fsck.com/mailman/listinfo/rt-devel
>
More information about the Rt-devel
mailing list