From owner-svn-ports-all@freebsd.org Sat Nov 14 12:34:56 2020 Return-Path: Delivered-To: svn-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4B7C22E9633; Sat, 14 Nov 2020 12:34:56 +0000 (UTC) (envelope-from mr@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYFCh1k1Mz4tHN; Sat, 14 Nov 2020 12:34:56 +0000 (UTC) (envelope-from mr@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2E0722124; Sat, 14 Nov 2020 12:34:56 +0000 (UTC) (envelope-from mr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AECYuwq098507; Sat, 14 Nov 2020 12:34:56 GMT (envelope-from mr@FreeBSD.org) Received: (from mr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AECYtFb098506; Sat, 14 Nov 2020 12:34:55 GMT (envelope-from mr@FreeBSD.org) Message-Id: <202011141234.0AECYtFb098506@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mr set sender to mr@FreeBSD.org using -f From: Michael Reifenberger Date: Sat, 14 Nov 2020 12:34:55 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r555110 - in head/databases/pear-Horde_Db: . files X-SVN-Group: ports-head X-SVN-Commit-Author: mr X-SVN-Commit-Paths: in head/databases/pear-Horde_Db: . files X-SVN-Commit-Revision: 555110 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 12:34:56 -0000 Author: mr Date: Sat Nov 14 12:34:55 2020 New Revision: 555110 URL: https://svnweb.freebsd.org/changeset/ports/555110 Log: Add upstream patch to Postgresql/Schema.php fixing the access for PostgreSQL >= 12 (extracted from the github repo of Horde-Db) Maintainer timeout: 2 weeks Modified: head/databases/pear-Horde_Db/Makefile head/databases/pear-Horde_Db/files/patch-lib_Horde_Db_Adapter_Postgresql_Schema.php Modified: head/databases/pear-Horde_Db/Makefile ============================================================================== --- head/databases/pear-Horde_Db/Makefile Sat Nov 14 12:04:57 2020 (r555109) +++ head/databases/pear-Horde_Db/Makefile Sat Nov 14 12:34:55 2020 (r555110) @@ -2,7 +2,7 @@ PORTNAME= Horde_Db PORTVERSION= 2.4.0 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= databases www pear MAINTAINER= horde@FreeBSD.org Modified: head/databases/pear-Horde_Db/files/patch-lib_Horde_Db_Adapter_Postgresql_Schema.php ============================================================================== --- head/databases/pear-Horde_Db/files/patch-lib_Horde_Db_Adapter_Postgresql_Schema.php Sat Nov 14 12:04:57 2020 (r555109) +++ head/databases/pear-Horde_Db/files/patch-lib_Horde_Db_Adapter_Postgresql_Schema.php Sat Nov 14 12:34:55 2020 (r555110) @@ -1,5 +1,5 @@ ---- lib/Horde/Db/Adapter/Postgresql/Schema.php.orig 2017-02-27 10:00:17 UTC -+++ lib/Horde/Db/Adapter/Postgresql/Schema.php +--- lib/Horde/Db/Adapter/Postgresql/Schema.php.orig 2017-02-27 11:00:17.000000000 +0100 ++++ lib/Horde/Db/Adapter/Postgresql/Schema.php 2020-10-28 00:40:32.469743000 +0100 @@ -3,12 +3,15 @@ * Copyright 2007 Maintainable Software, LLC * Copyright 2008-2017 Horde LLC (http://www.horde.org/) @@ -29,7 +29,27 @@ * @package Db * @subpackage Adapter */ -@@ -1057,13 +1062,32 @@ class Horde_Db_Adapter_Postgresql_Schema extends Horde +@@ -383,12 +388,13 @@ class Horde_Db_Adapter_Postgresql_Schema + { + /* @todo See if we can get this from information_schema instead */ + return $this->selectAll(' +- SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull +- FROM pg_attribute a LEFT JOIN pg_attrdef d +- ON a.attrelid = d.adrelid AND a.attnum = d.adnum +- WHERE a.attrelid = ' . $this->quote($tableName) . '::regclass +- AND a.attnum > 0 AND NOT a.attisdropped +- ORDER BY a.attnum', $name); ++ SELECT a.attname, format_type(a.atttypid, a.atttypmod), ++ pg_get_expr(d.adbin, d.adrelid) AS adsrc, a.attnotnull ++ FROM pg_attribute a ++ LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum ++ WHERE a.attrelid = ' . $this->quote($tableName) . '::regclass ++ AND a.attnum > 0 AND NOT a.attisdropped ++ ORDER BY a.attnum;', $name); + } + + /** +@@ -1057,13 +1063,32 @@ class Horde_Db_Adapter_Postgresql_Schema $quotedSequence = $this->quoteSequenceName($sequence); $quotedTable = $this->quoteTableName($table); $quotedPk = $this->quoteColumnName($pk); @@ -69,7 +89,46 @@ $this->selectValue($sql, 'Reset sequence'); } else { if ($this->_logger) { -@@ -1138,9 +1162,7 @@ class Horde_Db_Adapter_Postgresql_Schema extends Horde +@@ -1103,28 +1128,20 @@ class Horde_Db_Adapter_Postgresql_Schema + $result = $this->selectOne($sql, 'PK and serial sequence'); + + if (!$result) { +- // If that fails, try parsing the primary key's default value. +- // Support the 7.x and 8.0 nextval('foo'::text) as well as +- // the 8.1+ nextval('foo'::regclass). + $sql = " +- SELECT attr.attname, +- CASE +- WHEN split_part(def.adsrc, '''', 2) ~ '.' THEN +- substr(split_part(def.adsrc, '''', 2), +- strpos(split_part(def.adsrc, '''', 2), '.')+1) +- ELSE split_part(def.adsrc, '''', 2) +- END AS relname +- FROM pg_class t +- JOIN pg_attribute attr ON (t.oid = attrelid) +- JOIN pg_attrdef def ON (adrelid = attrelid AND adnum = attnum) +- JOIN pg_constraint cons ON (conrelid = adrelid AND adnum = conkey[1]) +- WHERE t.oid = '$table'::regclass +- AND cons.contype = 'p' +- AND def.adsrc ~* 'nextval'"; +- ++ SELECT c.column_name, c.ordinal_position, ++ pg_get_serial_sequence(t.table_name, c.column_name) as relname ++ FROM information_schema.key_column_usage AS c ++ LEFT JOIN information_schema.table_constraints AS t ++ ON t.constraint_name = c.constraint_name ++ WHERE t.table_name = '$table' AND t.constraint_type = 'PRIMARY KEY';"; + $result = $this->selectOne($sql, 'PK and custom sequence'); + } + ++ if (!$result) { ++ return array(null, null); ++ } ++ + // [primary_key, sequence] + return array($result['attname'], $result['relname']); + } +@@ -1138,9 +1155,7 @@ class Horde_Db_Adapter_Postgresql_Schema { if (!$this->_version) { try {