Nonrepeatable Read and Phantom Read possible?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Helveticus
    New Member
    • Oct 2014
    • 1

    Nonrepeatable Read and Phantom Read possible?

    Hi

    I'm using postgreSQL 9.3 and I have the following two types of stored procedures (only the statements given):

    Code:
    INSERT INTO table1 (col1, col2, col3, col4, col5) 
    SELECT $1, $2, $3, $4, $5
    WHERE EXISTS (SELECT id FROM table2 q WHERE q.id = $1) RETURNING table1.id;
    Code:
    DELETE FROM table1 m WHERE m.id = (
        SELECT m.id FROM table1 m 
        WHERE   m.col1 = $1 
        AND     coalesce($2, m.col2) = m.col2
        AND     coalesce(m.col3, $3) = $3 
        ORDER BY m.date ASC 
        LIMIT 1
        FOR UPDATE
    ) RETURNING m.id, m.col1, m.col2, m.col3, m.col4, m.col5, m.col6;
    The $x represents input to the stored procedures. I ommited the function declaration.

    Is Nonrepeatable Read and Phantom Read possible with this two stored procedures?
Working...