postgresql7.1 select case when count(*) = 0 then 0 else 1 end from site_nodes where name = :name and parent_id = :parent_id and node_id <> :new_node_id select site_node__new ( :new_node_id, :parent_id, :name, null, :directory_p, :pattern_p, :user_id, :ip_address ) select case when count(*) = 0 then 0 else 1 end from site_nodes where node_id = :new_node_id