diff --git a/dblayeroo.php b/dblayeroo.php index 995b2ca..9447287 100644 --- a/dblayeroo.php +++ b/dblayeroo.php @@ -2765,6 +2765,10 @@ class dblayeroo } $this->debugLog ("Entering createRequest ()"); $sql = $this->createRequest (); + if ($this->driver === "pgsql" && $this->command === "INSERT") + { + $sql .= " RETURNING ".$this->sep.$this->primary.$this->sep; + } $this->debugLog ("Entering prepareRequest (XXX, ",false,")"); $st = $this->prepareRequest ($sql, false); $this->debugLog ("'",$this->getDisplayQuery (),"'"); @@ -2863,8 +2867,9 @@ class dblayeroo else { $this->debugLog ("INSERT: PgSQL INSERT without Autoincrement. ". - "Return 1"); - return 1; + "Return the PK value defined in RETURN part"); + $result = $st->fetch (PDO::FETCH_ASSOC); + return $result[$this->primary]; } } $this->debugLog ("INSERT: lastInsertId=",