Conditional DELETE and INSERT in PostgreSQL

  • Comments posted to this topic are about the item Conditional DELETE and INSERT in PostgreSQL

    Sabyasachi Mukherjee

  • Thank you. I am starting to work on converting MS SQL to PostgreSQL so this is helpful.

    There is some minor confusion in your first example. Based on the order of the INSERT statements I would have thought that the David record would have been assigned employee_id of 3. However this row gets deleted because he was apparently assigned employee_id 2? Is there something else going on that would have changed the order of assignment?

    I get what you are showing, but it seems that might be confusing for some who are not familiar with the SERIAL pseudo-type and sequences.

     

  • You're right Tim. Now I remember, possibly I ran the query in the other order for David and Stephen. Later when I attached the queries for reference, I pasted in other order. Rightly pointed out. Thanks.

    Sabyasachi Mukherjee

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply