<p>is there an alternative for <code>mysql_insert_id()</code> php function for PostgreSQL? Most of the frameworks are solving the problem partially by finding the current value of the sequence used in the ID. However, there are times that the primary key is not a serial column....</p>

Check out the
RETURNING optional clause
for an INSERT statement. (Link to official PostgreSQL documentation)
But basically, you do:
```
```
INSERT INTO table (col1, col2) VALUES (1, 2) RETURNING pkey_col
```
```
and the INSERT statement itself returns the id (or whatever expression you specify) of the affected row.