postgresql null값 처리
COALESCE(대상, ex1, ex2...)
(select COALESCE (max(idx)+1, 1))
참고 - https://ysyblog.tistory.com/133