#!/usr/bin/perl

# DBD::Pg placeholder test

use DBI;
my $dbh = DBI->connect("dbi:Pg:dbname=fast", undef, undef);

my $q1 = $dbh->prepare('SELECT count(*) FROM pg_class WHERE relpages > $1');

# Does not segfault

$q1->execute(2);

(my $r1) = $q1->fetchrow;

print "Result: $r1\n";

my $q2 = $dbh->prepare('SELECT count(*) FROM pg_class WHERE relpages > $1 AND reltuples > $1');

# Segfaults

$q2->execute(2);

(my $r2) = $q2->fetchrow;

print "Result: $r2\n";

close $trace;
