[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: /opt/ledgersmb/LedgerSMB/Database.pm


On Mon, Aug 3, 2015 at 9:43 PM, R. Ransbottom <..hidden..> wrote:
Nibbling through errors installing 1.4.12.

<     # Install the plpgsql language unless it is there.
<     my $plpgsql = $self->dbh->do(
<               "SELECT count(*) FROM pg_language WHERE lanname='plpgsql'");
<     # $plpgsql domain:  undef, -1, or count
<     unless ( defined($plpgsql) && $plpgsql > 0) {
<       $self->dbh->do("CREATE LANGUAGE plpgsql");
<       $self->dbh->commit;
<     }
>     # The statement below is likely to fail, because
>     # the language already exists. Unfortunately, it's an error.
>     # If it had been a notice,
>     $self->dbh->do("CREATE LANGUAGE plpgsql");
>     $self->dbh->commit;
Thanks! It's good to polish the errors out of the database creation process (and any other warnings and errors that end up in the logs, for that matter).

I've refactored your submission in order to be able to check the return value of the DBI driver on every step in the process. It's my experience that not doing that can lead to hours of searching for why a statement goes wrong when in fact it's not *that* statement which is in error, but one of the (unchecked) statements before it.

Anyway: Thanks again! I'm working it into 1.4.14.



http://efficito.com -- Hosted accounting and ERP.
Robust and Flexible. No vendor lock-in.
Ledger-smb-devel mailing list