Thread

  1. OT - pg perl DBI question

    Glyn Astill <glynastill@yahoo.co.uk> — 2008-01-29T12:24:05Z

    Hi chaps,
    
    I'm trying yo run a perl script that uses DBI (Slonys
    psql_replication_check.pl to be precise) and I'm getting the error:
    
    Can't locate Pg.pm in @INC
    
    Now I do have the file in /usr/lib/perl5/DBD/ but the script can't
    see it. I'm guessing that unless I fudge it and put the absoloute
    path in the script, I need to set some sort of path somewhere, but
    I'm lost as to what or where.
    
    Could someone point me in the correct direction please?
    
    
    
    
    
    
          ___________________________________________________________
    Support the World Aids Awareness campaign this month with Yahoo! For Good http://uk.promotions.yahoo.com/forgood/
    
    
    
  2. Re: OT - pg perl DBI question

    Cat <cat@zip.com.au> — 2008-01-29T12:30:28Z

    On Tue, Jan 29, 2008 at 04:24:05AM -0800, Glyn Astill wrote:
    > I'm trying yo run a perl script that uses DBI (Slonys
    > psql_replication_check.pl to be precise) and I'm getting the error:
    > 
    > Can't locate Pg.pm in @INC
    > 
    > Now I do have the file in /usr/lib/perl5/DBD/ but the script can't
    > see it. I'm guessing that unless I fudge it and put the absoloute
    > path in the script, I need to set some sort of path somewhere, but
    > I'm lost as to what or where.
    > 
    > Could someone point me in the correct direction please?
    
    Run perl -V and see if the path is there for @INC. If it's there, check
    such things as permissions. If not, ponder deeply as to why this is so
    (as /usr/lib/perl5 is a standard path for perl in /usr) and if you can't
    fix it 'properly' you can work-around with the use of 'use lib' (see 
    perldoc perlvar and search for @INC).
    
    -- 
        "To the extent that we overreact, we proffer the terrorists the
        greatest tribute."
        	- High Court Judge Michael Kirby
    
    
  3. Re: OT - pg perl DBI question

    Glyn Astill <glynastill@yahoo.co.uk> — 2008-01-29T12:45:48Z

     
    > Run perl -V and see if the path is there for @INC. If it's there,
    > check
    > such things as permissions. If not, ponder deeply as to why this is
    > so
    > (as /usr/lib/perl5 is a standard path for perl in /usr) and if you
    > can't
    > fix it 'properly' you can work-around with the use of 'use lib'
    > (see 
    > perldoc perlvar and search for @INC).
    
    perl -V shows
    
      @INC:
        /etc/perl
        /usr/local/lib/perl/5.8.8
        /usr/local/share/perl/5.8.8
        /usr/lib/perl5
        /usr/share/perl5
        /usr/lib/perl/5.8
        /usr/share/perl/5.8
        /usr/local/lib/site_perl
    
    Should the subdirectory DBD be in there? Perl was setup using apt.
    
    
          __________________________________________________________
    Sent from Yahoo! Mail - a smarter inbox http://uk.mail.yahoo.com
    
    
    
    
  4. Re: OT - pg perl DBI question

    Cat <cat@zip.com.au> — 2008-01-29T12:54:32Z

    On Tue, Jan 29, 2008 at 04:45:48AM -0800, Glyn Astill wrote:
    > Should the subdirectory DBD be in there? Perl was setup using apt.
    
    How are you using it and what's your DBI db connect line?
    
    I'm about to go to sleep so if I don't reply it'll be because I'm
    unconcious. :)
    
    -- 
        "To the extent that we overreact, we proffer the terrorists the
        greatest tribute."
        	- High Court Judge Michael Kirby
    
    
  5. Re: OT - pg perl DBI question

    Glyn Astill <glynastill@yahoo.co.uk> — 2008-01-29T13:10:00Z

    well its using the pgsql_replication_check.pl, which does:
    
    ----------------------
    use Pg;
    use Getopt::Std;
    
    our ($opt_h, $opt_d, $opt_p, $opt_U, $opt_w, $opt_c) = '';
    my ($conn, $res, $status, @tuple);
    my $query = 'SELECT * FROM replication_status' ;
    my @rep_time;
    ---------------------------------------
    
    But the error I ge t is:
    
    an't locate Pg.pm in @INC (@INC contains: /etc/perl
    /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5
    /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8
    /usr/local/lib/site_perl .) at psql_replication_check.pl line 12.
    BEGIN failed--compilation aborted at psql_replication_check.pl line
    12.
    
    So I assume it's not getting past the use Pg line as although it's
    looking in /usr/lib/perl5 it's not going to look in
    /usr/lib/perl5/DBD ??
    
    
    --- CaT <cat@zip.com.au> wrote:
    
    > On Tue, Jan 29, 2008 at 04:45:48AM -0800, Glyn Astill wrote:
    > > Should the subdirectory DBD be in there? Perl was setup using
    > apt.
    > 
    > How are you using it and what's your DBI db connect line?
    > 
    > I'm about to go to sleep so if I don't reply it'll be because I'm
    > unconcious. :)
    > 
    > -- 
    >     "To the extent that we overreact, we proffer the terrorists the
    >     greatest tribute."
    >     	- High Court Judge Michael Kirby
    > 
    
    
    
          __________________________________________________________
    Sent from Yahoo! Mail - a smarter inbox http://uk.mail.yahoo.com
    
    
    
    
  6. Re: OT - pg perl DBI question

    Cat <cat@zip.com.au> — 2008-01-29T13:20:30Z

    On Tue, Jan 29, 2008 at 05:10:00AM -0800, Glyn Astill wrote:
    > well its using the pgsql_replication_check.pl, which does:
    > 
    > ----------------------
    > use Pg;
    ...
    > So I assume it's not getting past the use Pg line as although it's
    > looking in /usr/lib/perl5 it's not going to look in
    > /usr/lib/perl5/DBD ??
    
    No. It's not using the DBI Pg. There's another module. A standalone one
    that I believe it may be using. Under Debian this is available as
    libpg-perl. Your OS/Distro may vary. If you don't have it available as a
    package, check with CPAN.
    
    Zzz...
    
    -- 
        "To the extent that we overreact, we proffer the terrorists the
        greatest tribute."
        	- High Court Judge Michael Kirby
    
    
  7. Re: OT - pg perl DBI question

    Richard Huxton <dev@archonet.com> — 2008-01-29T13:25:21Z

    Glyn Astill wrote:
    > well its using the pgsql_replication_check.pl, which does:
    > 
    > ----------------------
    > use Pg;
    > use Getopt::Std;
    
    > 
    > So I assume it's not getting past the use Pg line as although it's
    > looking in /usr/lib/perl5 it's not going to look in
    > /usr/lib/perl5/DBD ??
    
    DBD::Pg is not the same as Pg.pm
    
    perldoc DBD::Pg
    perldoc Pg
    
    I think it's libpg-perl that you want.
    
    -- 
       Richard Huxton
       Archonet Ltd
    
    
  8. Re: OT - pg perl DBI question

    adam_pgsql <adam_pgsql@witneyweb.org> — 2008-01-29T13:30:04Z

    this looks to be using the Pg module rather than DBI + DBD::Pg. This  
    one i think:
    
    http://www.cpan.org/authors/id/M/ME/MERGL/pgsql_perl5-1.9.0.tar.gz
    
    i think thats quite old now though....
    
    
    On 29 Jan 2008, at 13:10, Glyn Astill wrote:
    
    > well its using the pgsql_replication_check.pl, which does:
    >
    > ----------------------
    > use Pg;
    > use Getopt::Std;
    >
    > our ($opt_h, $opt_d, $opt_p, $opt_U, $opt_w, $opt_c) = '';
    > my ($conn, $res, $status, @tuple);
    > my $query = 'SELECT * FROM replication_status' ;
    > my @rep_time;
    > ---------------------------------------
    >
    > But the error I ge t is:
    >
    > an't locate Pg.pm in @INC (@INC contains: /etc/perl
    > /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5
    > /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8
    > /usr/local/lib/site_perl .) at psql_replication_check.pl line 12.
    > BEGIN failed--compilation aborted at psql_replication_check.pl line
    > 12.
    >
    > So I assume it's not getting past the use Pg line as although it's
    > looking in /usr/lib/perl5 it's not going to look in
    > /usr/lib/perl5/DBD ??
    >
    >
    > --- CaT <cat@zip.com.au> wrote:
    >
    >> On Tue, Jan 29, 2008 at 04:45:48AM -0800, Glyn Astill wrote:
    >>> Should the subdirectory DBD be in there? Perl was setup using
    >> apt.
    >>
    >> How are you using it and what's your DBI db connect line?
    >>
    >> I'm about to go to sleep so if I don't reply it'll be because I'm
    >> unconcious. :)
    >>
    >> -- 
    >>    "To the extent that we overreact, we proffer the terrorists the
    >>    greatest tribute."
    >>    	- High Court Judge Michael Kirby
    >>
    >
    >
    >
    >      __________________________________________________________
    > Sent from Yahoo! Mail - a smarter inbox http://uk.mail.yahoo.com
    >
    >
    >
    > ---------------------------(end of  
    > broadcast)---------------------------
    > TIP 4: Have you searched our list archives?
    >
    >               http://archives.postgresql.org/
    
    
    
  9. Re: OT - pg perl DBI question

    Colin Wetherbee <cww@denterprises.org> — 2008-01-29T13:30:09Z

    CaT wrote:
    > On Tue, Jan 29, 2008 at 05:10:00AM -0800, Glyn Astill wrote:
    >> well its using the pgsql_replication_check.pl, which does:
    >>
    >> ----------------------
    >> use Pg;
    > ...
    >> So I assume it's not getting past the use Pg line as although it's
    >> looking in /usr/lib/perl5 it's not going to look in
    >> /usr/lib/perl5/DBD ??
    > 
    > No. It's not using the DBI Pg. There's another module. A standalone one
    > that I believe it may be using. Under Debian this is available as
    > libpg-perl. Your OS/Distro may vary. If you don't have it available as a
    > package, check with CPAN.
    
    On Debian, you want libdbd-pg-perl.
    
    cww@iron:~$ dpkg -S /usr/lib/perl5/DBD/Pg.pm
    libdbd-pg-perl: /usr/lib/perl5/DBD/Pg.pm
    
    To the OP: FYI, the DBI mailing lists can be found at the following URL.
    
    http://dbi.perl.org/support/
    
    Colin
    
    
  10. Re: OT - pg perl DBI question

    Colin Wetherbee <cww@denterprises.org> — 2008-01-29T13:36:57Z

    adam_pgsql wrote:
    > this looks to be using the Pg module rather than DBI + DBD::Pg. This one 
    > i think:
    > 
    > http://www.cpan.org/authors/id/M/ME/MERGL/pgsql_perl5-1.9.0.tar.gz
    > 
    > i think thats quite old now though....
    
    Indeed, that's how it looks.  That would be in the libpg-perl package on 
    Debian.  In Lenny (testing), the latest version of that is 1:2.1.1-3.
    
    Colin
    
    
  11. Re: OT - pg perl DBI question

    Colin Wetherbee <cww@denterprises.org> — 2008-01-29T13:37:59Z

    Colin Wetherbee wrote:
    > CaT wrote:
    >> On Tue, Jan 29, 2008 at 05:10:00AM -0800, Glyn Astill wrote:
    >>> well its using the pgsql_replication_check.pl, which does:
    >>>
    >>> ----------------------
    >>> use Pg;
    >> ...
    >>> So I assume it's not getting past the use Pg line as although it's
    >>> looking in /usr/lib/perl5 it's not going to look in
    >>> /usr/lib/perl5/DBD ??
    >>
    >> No. It's not using the DBI Pg. There's another module. A standalone one
    >> that I believe it may be using. Under Debian this is available as
    >> libpg-perl. Your OS/Distro may vary. If you don't have it available as a
    >> package, check with CPAN.
    > 
    > On Debian, you want libdbd-pg-perl.
    > 
    > cww@iron:~$ dpkg -S /usr/lib/perl5/DBD/Pg.pm
    > libdbd-pg-perl: /usr/lib/perl5/DBD/Pg.pm
    > 
    > To the OP: FYI, the DBI mailing lists can be found at the following URL.
    > 
    > http://dbi.perl.org/support/
    
    Please ignore my noise.  The OP isn't using DBI, and libpg-perl is the 
    correct package for Pg.
    
    Colin
    
    
  12. Re: OT - pg perl DBI question

    Martijn van Oosterhout <kleptog@svana.org> — 2008-01-29T13:39:05Z

    On Tue, Jan 29, 2008 at 01:30:04PM +0000, adam_pgsql wrote:
    > 
    > this looks to be using the Pg module rather than DBI + DBD::Pg. This  
    > one i think:
    > 
    > http://www.cpan.org/authors/id/M/ME/MERGL/pgsql_perl5-1.9.0.tar.gz
    > 
    > i think thats quite old now though....
    
    In the one in this package:
    http://packages.debian.org/lenny/libpg-perl
    
    It's not old. It's kept reasonably up to date. It's more or less a shim
    over the C library and has direct access to all its features, which is
    not always possible with DBD:Pg.
    
    Have a nice day,
    -- 
    Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
    > Those who make peaceful revolution impossible will make violent revolution inevitable.
    >  -- John F Kennedy
    
  13. Re: OT - pg perl DBI question

    adam_pgsql <adam_pgsql@witneyweb.org> — 2008-01-29T13:56:03Z

    On 29 Jan 2008, at 13:39, Martijn van Oosterhout wrote:
    
    > On Tue, Jan 29, 2008 at 01:30:04PM +0000, adam_pgsql wrote:
    >>
    >> this looks to be using the Pg module rather than DBI + DBD::Pg. This
    >> one i think:
    >>
    >> http://www.cpan.org/authors/id/M/ME/MERGL/pgsql_perl5-1.9.0.tar.gz
    >>
    >> i think thats quite old now though....
    >
    > In the one in this package:
    > http://packages.debian.org/lenny/libpg-perl
    >
    > It's not old. It's kept reasonably up to date. It's more or less a  
    > shim
    > over the C library and has direct access to all its features, which is
    > not always possible with DBD:Pg.
    
    ah sorry, i was just looking at the date on CPAN for  
    pgsql_perl5-1.9.0.tar.gz which says 04-Apr-2000.
    
    Thanks for the more up to date info though.
    
    adam
    
    
  14. Re: OT - pg perl DBI question

    Glyn Astill <glynastill@yahoo.co.uk> — 2008-01-29T14:21:34Z

    Hi chaps,
    
    Excellent, it was libpg-perl I needed.
    
    Thanks
    
    --- Richard Huxton <dev@archonet.com> wrote:
    
    > Glyn Astill wrote:
    > > well its using the pgsql_replication_check.pl, which does:
    > > 
    > > ----------------------
    > > use Pg;
    > > use Getopt::Std;
    > 
    > > 
    > > So I assume it's not getting past the use Pg line as although
    > it's
    > > looking in /usr/lib/perl5 it's not going to look in
    > > /usr/lib/perl5/DBD ??
    > 
    > DBD::Pg is not the same as Pg.pm
    > 
    > perldoc DBD::Pg
    > perldoc Pg
    > 
    > I think it's libpg-perl that you want.
    > 
    > -- 
    >    Richard Huxton
    >    Archonet Ltd
    > 
    
    
    
          __________________________________________________________
    Sent from Yahoo! Mail - a smarter inbox http://uk.mail.yahoo.com
    
    
    
    
  15. Re: OT - pg perl DBI question

    David Fetter <david@fetter.org> — 2008-01-29T16:14:28Z

    On Tue, Jan 29, 2008 at 05:10:00AM -0800, Glyn Astill wrote:
    > well its using the pgsql_replication_check.pl, which does:
    > 
    > ----------------------
    > use Pg;
    
    I wouldn't trust that library or anything that depends on it if I were
    you.  It's been unmaintained for a *very* long time.
    
    Cheers,
    David.
    -- 
    David Fetter <david@fetter.org> http://fetter.org/
    Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
    Skype: davidfetter      XMPP: david.fetter@gmail.com
    
    Remember to vote!
    Consider donating to Postgres: http://www.postgresql.org/about/donate
    
    
  16. Re: OT - pg perl DBI question

    Andrew Sullivan <ajs@crankycanuck.ca> — 2008-01-29T18:01:02Z

    On Tue, Jan 29, 2008 at 04:24:05AM -0800, Glyn Astill wrote:
    > Hi chaps,
    > 
    > I'm trying yo run a perl script that uses DBI (Slonys
    > psql_replication_check.pl to be precise) and I'm getting the error:
    > 
    > Can't locate Pg.pm in @INC
    
    Pg.pm isn't DBI.  It's the Pg Perl interface.
    
    A
    
    
  17. Re: OT - pg perl DBI question

    Andrew Sullivan <ajs@crankycanuck.ca> — 2008-01-29T18:07:26Z

    On Tue, Jan 29, 2008 at 08:14:28AM -0800, David Fetter wrote:
    > 
    > I wouldn't trust that library or anything that depends on it if I were
    > you.  It's been unmaintained for a *very* long time.
    
    Because code rusts when it's sitting around on a hard drive?
    
    Pg.pm doesn't get much attention, I agree, but I've actually never run into
    a (n undocumented) bug with it.  Also, for simple Perl access for
    Postgres-dedicated use, DBI can be a little heavyweight.
    
    A
    
    
    
  18. Re: OT - pg perl DBI question

    Geoffrey <lists@serioustechnology.com> — 2008-01-29T18:28:13Z

    David Fetter wrote:
    > On Tue, Jan 29, 2008 at 05:10:00AM -0800, Glyn Astill wrote:
    >> well its using the pgsql_replication_check.pl, which does:
    >>
    >> ----------------------
    >> use Pg;
    > 
    > I wouldn't trust that library or anything that depends on it if I were
    > you.  It's been unmaintained for a *very* long time.
    
    Are you speaking from personal experience, or just of the lack of 
    maintenance?
    
    -- 
    Until later, Geoffrey
    
    Those who would give up essential Liberty, to purchase a little
    temporary Safety, deserve neither Liberty nor Safety.
      - Benjamin Franklin
    
    
  19. Re: OT - pg perl DBI question

    Vivek Khera <khera@kcilink.com> — 2008-01-29T18:43:05Z

    On Jan 29, 2008, at 7:24 AM, Glyn Astill wrote:
    
    > I'm trying yo run a perl script that uses DBI (Slonys
    > psql_replication_check.pl to be precise) and I'm getting the error:
    >
    > Can't locate Pg.pm in @INC
    >
    
    It doesn't use DBI, it uses Pg.  At some point I posted patches to  
    convert it to DBI and DBD::Pg, but I don't know where those are  
    anymore as I don't use that code.
    
    
    
  20. Re: OT - pg perl DBI question

    AgentM <agentm@themactionfaction.com> — 2008-01-29T18:56:35Z

    On Jan 29, 2008, at 1:07 PM, Andrew Sullivan wrote:
    
    > On Tue, Jan 29, 2008 at 08:14:28AM -0800, David Fetter wrote:
    >>
    >> I wouldn't trust that library or anything that depends on it if I  
    >> were
    >> you.  It's been unmaintained for a *very* long time.
    >
    > Because code rusts when it's sitting around on a hard drive?
    >
    > Pg.pm doesn't get much attention, I agree, but I've actually never  
    > run into
    > a (n undocumented) bug with it.  Also, for simple Perl access for
    > Postgres-dedicated use, DBI can be a little heavyweight.
    >
    
    You mean other than the fact that it doesn't support the V3 protocol,  
    doesn't support escaping parameters, is a one-for-one wrapper for the  
    libpq from eight years ago (and has never been updated since), there  
    is a timing bug from 4 years ago still open (http://rt.cpan.org/ 
    Public/Bug/Display.html?id=3177), and the docs include zingers like
    "Starting with postgresql-6.5 it is required to use large objects  
    only inside a transaction"?
    
    The postgresql from eight years ago is also quite rusty.
    
    Cheers,
    M
    
    
  21. Re: OT - pg perl DBI question

    Andrew Sullivan <ajs@crankycanuck.ca> — 2008-01-29T19:36:11Z

    On Tue, Jan 29, 2008 at 01:56:35PM -0500, A.M. wrote:
    > The postgresql from eight years ago is also quite rusty.
    
    No, it's not, which is my point.  If you don't need any of the features you
    mention, and are aware of the limitations, there's nothing wrong with
    using it.  The v2 protocol works, for instance, and for some applications
    there's nothing wrong with it.
    
    I wouldn't start a large project using Pg.pm right now, for sure, but I
    think dismissing code you don't use on the basis that it's old is just
    silly.  The reason we say "upgrade your postgresql" is not because it's old,
    but because there are _known_ bugs in it, and those bugs eat data.  
    
    A
    
    
    
  22. Re: OT - pg perl DBI question

    AgentM <agentm@themactionfaction.com> — 2008-01-29T20:16:41Z

    On Jan 29, 2008, at 2:36 PM, Andrew Sullivan wrote:
    
    > On Tue, Jan 29, 2008 at 01:56:35PM -0500, A.M. wrote:
    >> The postgresql from eight years ago is also quite rusty.
    >
    > No, it's not, which is my point.  If you don't need any of the  
    > features you
    > mention, and are aware of the limitations, there's nothing wrong with
    > using it.  The v2 protocol works, for instance, and for some  
    > applications
    > there's nothing wrong with it.
    >
    > I wouldn't start a large project using Pg.pm right now, for sure,  
    > but I
    > think dismissing code you don't use on the basis that it's old is just
    > silly.  The reason we say "upgrade your postgresql" is not because  
    > it's old,
    > but because there are _known_ bugs in it, and those bugs eat data.
    >
    
    ...and Pg.pm includes a serious security hole in the form of non- 
    existent query escaping which will never be fixed. Are we really  
    discussing the semantics of "rust"?
    
    -M
    
    
  23. Re: OT - pg perl DBI question

    Andrew Sullivan <ajs@crankycanuck.ca> — 2008-01-29T20:30:48Z

    On Tue, Jan 29, 2008 at 03:16:41PM -0500, A.M. wrote:
    
    > ...and Pg.pm includes a serious security hole in the form of non- 
    > existent query escaping which will never be fixed. Are we really  
    > discussing the semantics of "rust"?
    
    It has never done that escaping.  No rust has occurred.  This is a problem
    that's been there forever.  So I am not discussing the semantics, no.  But
    we've certainly addressed the OP's question, and I guess this is rather off
    topic for the list.
    
    A
    
    
  24. Re: OT - pg perl DBI question

    Reece Hart <reece@harts.net> — 2008-01-30T02:36:02Z

    On Tue, 2008-01-29 at 13:28 -0500, Geoffrey wrote:
    
    > Are you speaking from personal experience, or just of the lack of 
    > maintenance?
    
    
    I'm guessing lack of maintenance... the SFPUG hasn't maintained David
    for a very long time. We think he lives at Casa Donde, but no one is
    really sure where that is.
    
    -- 
    Reece Hart, http://harts.net/reece/, GPG:0x25EC91A0
    
  25. Re: OT - pg perl DBI question

    Joshua D. Drake <jd@commandprompt.com> — 2008-01-30T03:08:31Z

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1
    
    On Tue, 29 Jan 2008 18:36:02 -0800
    Reece Hart <reece@harts.net> wrote:
     
    > I'm guessing lack of maintenance... the SFPUG hasn't maintained David
    > for a very long time. We think he lives at Casa Donde, but no one is
    > really sure where that is.
    
    I thought last year was the year David started maintaining himself?
    
    Joshua D. Drake
    
    - -- 
    The PostgreSQL Company: Since 1997, http://www.commandprompt.com/ 
    Sales/Support: +1.503.667.4564   24x7/Emergency: +1.800.492.2240
    Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
    PostgreSQL SPI Liaison | SPI Director |  PostgreSQL political pundit
    
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.6 (GNU/Linux)
    
    iD8DBQFHn+oxATb/zqfZUUQRAlLdAJ4wF1MJDKaVic+QmX3rC+WTU/W95wCgkv/C
    X4aDXoRyle3sIRh1MJyOwls=
    =2O9q
    -----END PGP SIGNATURE-----