using_psql1.htm
Objective: using psql of PostgreSQL : It is an PostgreSQL interactive terminal program, called psql.

You can run PostgreSQL using  command line, psql.exe and pgaAdminIII.exe programms.

I found psql.exe is very moody in windows envirnment, try command line and pgAdmin3.exe tools. 

To run a PostgreSQL over a terminal, please use this helpline, shown below.

http://www.postgresql.org/docs/9.3/static/tutorial-accessdb.html

In this workstation M9W8 (windows 8 ), I installed two versions of PostgreSQL
Run as an administer: Opens a command window:

command : psql -U postgres -h localhost postgres the password i used "postgre_manas9

Test a script

Script;

SELECT datname FROM pg_database WHERE datistemplate = false;

 

Switch  to another database: ignore the warnning

postgres=# connect pgsdemo1

More querying

 
Calling a stored function

-- Function: cfcal(numeric)

-- DROP FUNCTION cfcal(numeric);

CREATE OR REPLACE FUNCTION cfcal(i numeric)
RETURNS numeric AS
$BODY$
DECLARE
temp1 numeric ;
BEGIN
/*select cfcal(i+40) INTO temp1;*/
RETURN (i * 9/5) + 32 ;

END;

$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
ALTER FUNCTION cfcal(numeric)
OWNER TO postgres;
 

all tables in the current db