From PostgreSQL wiki

Jump to: navigation, search


Project Summary

pgScript is a scripting language for pgAdmin and PostgreSQL based on a T-SQL syntax. Therefore it runs on the client side.

Project page:

Detailed info

pgScript enhances PostgreSQL SQL commands with these additional features:

  • Control-of-flow language
  • Local variables
  • Random data generators

For instance:

SET @A = INTEGER(0, 10);           -- Random integer generator into @A
IF (SELECT 1 FROM table)           -- Then table exists
    SET @B = SELECT * FROM table;  -- Stores result of the query in @B
    INSERT INTO table VALUES (@A); -- Inserts a random integer
    PRINT @B;                      -- Prints result of the previous query
ELSE                               -- Else table does not exist
    CREATE TABLE table ( ... );    -- Regular PostgreSQL command

pgScript interprets the kind of script above. For more details please look at

pgScript is (will) also integrated into pgAdmin. You can access pgScript through the Query tool in pgAdmin: see for information & download.


There are two parts in the project:

  • (07/06) Make a standalone version (program or library) of pgScript
  • (08/10) Integrate it into pgAdmin


See for information & download.

--Mickael2278 21:51, 4 May 2008 (UTC)

Personal tools