From PostgreSQL wiki
Jump to navigationJump to search

Project Summary

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

Project development was ceased with PgAdmin version 4.

Archived project code:

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