From PostgreSQL wiki
pgScript is a scripting language for pgAdmin and PostgreSQL based on a T-SQL syntax. Therefore it runs on the client side.
Project page: http://pgfoundry.org/projects/pgscript
pgScript enhances PostgreSQL SQL commands with these additional features:
- Control-of-flow language
- Local variables
- Random data generators
SET @A = INTEGER(0, 10); -- Random integer generator into @A IF (SELECT 1 FROM table) -- Then table exists BEGIN 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 END ELSE -- Else table does not exist BEGIN CREATE TABLE table ( ... ); -- Regular PostgreSQL command END
pgScript interprets the kind of script above. For more details please look at http://pgscript.projects.postgresql.org.
pgScript is (will) also integrated into pgAdmin. You can access pgScript through the Query tool in pgAdmin: see http://www.pgadmin.org 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 http://pgscript.projects.postgresql.org for information & download.
--Mickael2278 21:51, 4 May 2008 (UTC)