PostgreSQL: Function to truncate all Tables created by Particular User

In this post, I am sharing one PostgreSQL user define function to truncate all Tables which are created by particular X User.

Sometimes, Database administrator or Database Developer creates one user only for test purpose and this TEST user created an N number of test rows or tables which is require drop or truncate.

Using this function you can truncate all tables of a database with the help of Owner and Schema input parameter.

Anvesh Patel

Leave a Reply

2 Comments on "PostgreSQL: Function to truncate all Tables created by Particular User"

Notify of
avatar
Sort by:   newest | oldest | most voted
Tyrell
Guest

Fine wway of explaining, and fastidious post tto get data regarding my presentatuon subject, which i am going to deliver iin college.

Grud
Guest

The info is extremely useful.|

wpDiscuz