Fix postgres error when displaying network graph.

fix #4149
Merge pull request #4164 from hiroponz/fix-postgres-error

Fix postgres error when displaying network graph.