Generate the “create table” sql statement for an existing table in postgreSQL 3 Ways

 In this video I have shown 3 ways to get create table statements for an existing table in postgreSQL. 1. By creating a function.   CREATE OR REPLACE FUNCTION generate_create_table_statement(p_table_name varchar) RETURNS text AS $BODY$ DECLARE v_table_ddl text; column_record record; BEGIN FOR column_record IN SELECT b.nspname as schema_name, b.relname as table_name, a.attname as column_name, …

Continue reading

Reset PostgreSQL password on Windows

In this video I have shown how to reset the forgotten password of PostgreSQL on windows 10 PC. 1. First locate the pg_hba.conf file inside the installation directory of PostgreSQL. In this example the file is located in ‘C:\Program Files\PostgreSQL\12\bin’. 2. Open the file in notepad and comment the below lines by putting # at …

Continue reading