Very simple query decomposition

This is just small simple hint but maybe someone could need it. If you have some not complicated query you can decompose it to parts using this query:   with srcquery as (select replace(lower( --this is some "normalization of the query string 'SELECT...

Find dependecies for some object

PostgreSQL can show you directly only these dependencies: table – view table column – view view – view view column – view …   You cannot check directly dependencies like: table (view) -> function table (view) column -> function...

How to alter table column which is used in views

Sometimes you need to alter data type or length of some table column which is used in views.This of course means to drop and recreate all those views and this also in right order. You can find some workaround in internet. But if you want to be really on the safe side...