!preg_match( '/^SELECT\s+pg_(try_|)advisory_\w+\(/', $sql );
}
+ /**
+ * @param string $sql
+ * @return bool|mixed|resource
+ */
public function doQuery( $sql ) {
$conn = $this->getBindingHandle();
return true;
}
+ protected function makeUpdateOptionsArray( $options ) {
+ if ( !is_array( $options ) ) {
+ $options = [ $options ];
+ }
+
+ // PostgreSQL doesn't support anything like "ignore" for
+ // UPDATE.
+ $options = array_diff( $options, [ 'IGNORE' ] );
+
+ return parent::makeUpdateOptionsArray( $options );
+ }
+
/**
* INSERT SELECT wrapper
* $varMap must be an associative array of the form [ 'dest1' => 'source1', ... ]
. ' 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 );
}
$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 );