Merge "rdbms: Remove references to pg_attrdef.adsrc in Postgres code" into REL1_31
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 14 Nov 2019 18:49:48 +0000 (18:49 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 14 Nov 2019 18:49:48 +0000 (18:49 +0000)
includes/libs/rdbms/database/DatabasePostgres.php
includes/libs/rdbms/field/PostgresField.php

index c4f05c5..9b09f96 100644 (file)
@@ -816,7 +816,7 @@ __INDEXATTR__;
                        . ' WHERE relkind = \'r\''
                        . ' AND nspname = ' . $this->addQuotes( $this->getCoreSchema() )
                        . ' AND relname = ' . $this->addQuotes( $oldName )
-                       . ' AND adsrc LIKE \'nextval(%\'',
+                       . ' AND pg_get_expr(adbin, adrelid) LIKE \'nextval(%\'',
                        $fname
                );
                $row = $this->fetchObject( $res );
@@ -851,10 +851,10 @@ __INDEXATTR__;
                        }
 
                        $oid = $this->fetchObject( $res )->oid;
-                       $res = $this->query( 'SELECT adsrc FROM pg_attribute a'
+                       $res = $this->query( 'SELECT pg_get_expr(adbin, adrelid) AS adsrc FROM pg_attribute a'
                                . ' JOIN pg_attrdef d ON (a.attrelid=d.adrelid and a.attnum=d.adnum)'
                                . " WHERE a.attrelid = $oid"
-                               . ' AND adsrc LIKE \'nextval(%\'',
+                               . ' AND pg_get_expr(adbin, adrelid) LIKE \'nextval(%\'',
                                $fname
                        );
                        $row = $this->fetchObject( $res );
index 53c3d33..7596a3b 100644 (file)
@@ -17,7 +17,7 @@ class PostgresField implements Field {
 SELECT
  attnotnull, attlen, conname AS conname,
  atthasdef,
- adsrc,
pg_get_expr(adbin, adrelid) AS adsrc,
  COALESCE(condeferred, 'f') AS deferred,
  COALESCE(condeferrable, 'f') AS deferrable,
  CASE WHEN typname = 'int2' THEN 'smallint'