Index: head/databases/p5-DBIx-SearchBuilder/Makefile =================================================================== --- head/databases/p5-DBIx-SearchBuilder/Makefile (revision 362766) +++ head/databases/p5-DBIx-SearchBuilder/Makefile (revision 362767) @@ -1,28 +1,29 @@ # Created by: Anton Berezin # $FreeBSD$ PORTNAME= DBIx-SearchBuilder PORTVERSION= 1.65 +PORTREVISION= 1 CATEGORIES= databases perl5 MASTER_SITES= CPAN PKGNAMEPREFIX= p5- MAINTAINER= demon@FreeBSD.org COMMENT= Perl extension for easy SQL SELECT Statement generation BUILD_DEPENDS= p5-Class-ReturnValue>=0:${PORTSDIR}/devel/p5-Class-ReturnValue \ p5-Cache-Simple-TimedExpiry>=0:${PORTSDIR}/devel/p5-Cache-Simple-TimedExpiry \ p5-Want>=0:${PORTSDIR}/devel/p5-Want \ p5-capitalization>=0:${PORTSDIR}/devel/p5-capitalization \ p5-DBI>=0:${PORTSDIR}/databases/p5-DBI \ p5-DBIx-DBSchema>=0:${PORTSDIR}/databases/p5-DBIx-DBSchema \ p5-Class-Accessor>=0:${PORTSDIR}/devel/p5-Class-Accessor \ p5-Clone>=0:${PORTSDIR}/devel/p5-Clone \ p5-Encode>=0:${PORTSDIR}/converters/p5-Encode RUN_DEPENDS:= ${BUILD_DEPENDS} TEST_DEPENDS= p5-DBD-SQLite>=0:${PORTSDIR}/databases/p5-DBD-SQLite USES= perl5 USE_PERL5= configure .include Index: head/databases/p5-DBIx-SearchBuilder/files/patch-upstream-1.65_1 =================================================================== --- head/databases/p5-DBIx-SearchBuilder/files/patch-upstream-1.65_1 (nonexistent) +++ head/databases/p5-DBIx-SearchBuilder/files/patch-upstream-1.65_1 (revision 362767) @@ -0,0 +1,46 @@ +--- lib/DBIx/SearchBuilder/Handle/Pg.pm 2013-07-02 21:12:09.000000000 +0400 ++++ lib/DBIx/SearchBuilder/Handle/Pg.pm 2014-07-08 23:11:22.000000000 +0400 +@@ -235,9 +235,15 @@ sub DistinctQuery { + # It's hard to show with tests. Pg's optimizer can choose execution + # plan not guaranting order + +- # So if we are ordering by something that is not in 'main', the we GROUP +- # BY all columns and adjust the ORDER_BY accordingly +- local $sb->{group_by} = [ map {+{FIELD => $_}} $self->Fields($table) ]; ++ my $groups; ++ if ($self->DatabaseVersion =~ /^(\d+)\.(\d+)/ and ($1 > 9 or ($1 == 9 and $2 >= 1))) { ++ # Pg 9.1 supports "SELECT main.foo ... GROUP BY main.id" if id is the primary key ++ $groups = [ {FIELD => "id"} ]; ++ } else { ++ # For earlier versions, we have to list out all of the columns ++ $groups = [ map {+{FIELD => $_}} $self->Fields($table) ]; ++ } ++ local $sb->{group_by} = $groups; + local $sb->{'order_by'} = [ + map { + ($_->{'ALIAS'}||'') ne "main" +--- lib/DBIx/SearchBuilder/Handle.pm 2013-06-06 23:06:18.000000000 +0400 ++++ lib/DBIx/SearchBuilder/Handle.pm 2014-07-08 23:11:22.000000000 +0400 +@@ -1428,18 +1428,19 @@ sub DistinctCount { + + sub Fields { + my $self = shift; +- my $table = shift; ++ my $table = lc shift; + +- unless ( keys %FIELDS_IN_TABLE ) { +- my $sth = $self->dbh->column_info( undef, '', '%', '%' ) ++ unless ( $FIELDS_IN_TABLE{$table} ) { ++ $FIELDS_IN_TABLE{ $table } = []; ++ my $sth = $self->dbh->column_info( undef, '', $table, '%' ) + or return (); + my $info = $sth->fetchall_arrayref({}); + foreach my $e ( @$info ) { +- push @{ $FIELDS_IN_TABLE{ lc $e->{'TABLE_NAME'} } ||= [] }, lc $e->{'COLUMN_NAME'}; ++ push @{ $FIELDS_IN_TABLE{ $table } }, lc $e->{'COLUMN_NAME'}; + } + } + +- return @{ $FIELDS_IN_TABLE{ lc $table } || [] }; ++ return @{ $FIELDS_IN_TABLE{ $table } }; + } Property changes on: head/databases/p5-DBIx-SearchBuilder/files/patch-upstream-1.65_1 ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property