Skip to content

db->query() return boolean when performing INSERT INTO RETURNING in postgresql #2490

@goFrendiAsgard

Description

@goFrendiAsgard

The quick and dirty solution is here: http://ellislab.com/forums/viewthread/88548/

Postgresql support "INSERT INTO RETURNING" as correct approach to get primary key value immediately after inserting.

I perform this to get that approach:

$insert_string = $this->db->insert_string($table_name,$post_array);
$insert_string .= ' RETURNING '. $this->db->protect_identifiers($primary_key).' AS last_id';
$query = $this->db->query($insert_string); // <-- here is the problem, $this->db->query return TRUE

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions