Search This Blog

Tuesday, February 9, 2010

Make Database Template in postgresql using php

Views

SELECT table_name,view_definition from information_schema.views where table_catalog='$db_name' and table_schema='$schema_name'  order by 1;

Tables 
SELECT table_name From information_schema.tables where table_type='BASE TABLE'  and table_catalog='$db_name' and table_schema='$schema_name'  order by 1;

Columns in a Table with properties

SELECT column_name,data_type,is_nullable from information_schema.columns where table_catalog='$db_name' and table_schema='$schema_name' and table_name='$table_name';


Functions 
SELECT routine_name,routine_definition from information_schema.routines where routine_schema='$schema_name' and routine_catalog='$db_name' order by 1;

No comments:

Post a Comment