src/Driver/Postgres/PostgresDriver.php
public function getPrimary(string $prefix, string $table): ?string
    {
        $name = $prefix . $table;
        if (array_key_exists($name, $this->primaryKeys)) {
            return $this->primaryKeys[$name];
        }

        if (!$this->hasTable($name)) {
            throw new DriverException(
                "Unable to fetch table primary key, no such table '{$name}' exists"
            );
        }

        $this->primaryKeys[$name] = $this->getSchema($table, $prefix)->getPrimaryKeys();
        if (count($this->primaryKeys[$name]) === 1) {
            //We do support only single primary key
            $this->primaryKeys[$name] = $this->primaryKeys[$name][0];
        } else {
            $this->primaryKeys[$name] = null;
        }

        return $this->primaryKeys[$name];
    }
public function getPrimary(string $prefix, string $table): ?string
    {
        $name = $prefix . $table;
        if (array_key_exists($name, $this->primaryKeys)) {
            return $this->primaryKeys[$name];
        }

        if (!$this->hasTable($name)) {
            throw new DriverException(
                "Unable to fetch table primary key, no such table '{$name}' exists"
            );
        }

        $this->primaryKeys[$name] = $this->getSchema($table, $prefix)->getPrimaryKeys();
        if (count($this->primaryKeys[$name]) === 1) {
            //We do support only single primary key
            $this->primaryKeys[$name] = $this->primaryKeys[$name][0];
        } else {
            $this->primaryKeys[$name] = null;
        }

        return $this->primaryKeys[$name];
    }
public function getPrimary ( string $ prefix , string $ table ) : ? string { $ name = $ prefix . $ table ; if ( array_key_exists ( $ name , $ this -> primaryKeys ) ) { return $ this -> primaryKeys [ $ name ] ; } if ( ! $ this -> hasTable ( $ name ) ) { throw new DriverException ( "Unable to fetch table primary key, no such table '{$name}' exists" ) ; } $ this -> primaryKeys [ $ name ] = $ this -> getSchema ( $ table , $ prefix ) -> getPrimaryKeys ( ) ; if ( count ( $ this -> primaryKeys [ $ name ] ) === 1 ) { //We do support only single primary key $ this -> primaryKeys [ $ name ] = $ this -> primaryKeys [ $ name ] [ 0 ] ; } else { $ this -> primaryKeys [ $ name ] = null ; } return $ this -> primaryKeys [ $ name ] ; }
Get singular primary key associated with desired table. Used to emulate last insert id.

@param string $prefix Database prefix if any.
@param string $table Fully specified table name, including postfix.

@return string|null

@throws DriverException
Get singular primary key associated with desired table . Used to emulate last insert id .