Want to deploy your JVM, Node.js and Go apps effortlessly to AWS? Try our service Boxfuse

EnterpriseDB

Versions

  • 9.4 and later (all editions, including PPCD)

Default Driver

  • com.edb.Driver

Sql Script Syntax

  • Standard Sql syntax with statement delimiter ;
  • SPL blocks starting with DECLARE or BEGIN and finishing with END; /
  • Stored procedures (CREATE FUNCTION with $$ escapes, as generated by pg_dump)
  • COPY ... FROM STDIN (as generated by pg_dump)

Compatibility

  • DDL exported by pg_dump can be used unchanged in a Flyway migration.
  • Any EnterpriseDB sql script executed by Flyway, can be executed by the EnterpriseDB version of psql and other EnterpriseDB-compatible tools (after the placeholders have been replaced).

Example - SPL Flavor

/* Single line comment */
CREATE TABLE test_user (
 name VARCHAR(25) NOT NULL,
 PRIMARY KEY(name)
);

/*
Multi-line
comment
*/
-- PL/SQL block
CREATE TRIGGER test_trig AFTER insert ON test_user
BEGIN
   UPDATE test_user SET name = CONCAT(name, ' triggered');
END;
/

-- Placeholder
INSERT INTO ${tableName} (name) VALUES ('Mr. T');

Example - SPL Flavor

/* Single line comment */
CREATE TABLE test_data (
 value VARCHAR(25) NOT NULL PRIMARY KEY
);


/*
Multi-line
comment
*/

-- Multi-statement PostgreSQL function
CREATE FUNCTION AddData() RETURNS INTEGER
AS $$
   BEGIN
    INSERT INTO test_data (value) VALUES ('Hello');
    RETURN 1;
  END;
$$ LANGUAGE plpgsql;

SELECT *  INTO TEMP adddata_temp_table FROM AddData() ;

-- Single-statement PostgreSQL function
CREATE FUNCTION add(integer, integer) RETURNS integer
   LANGUAGE sql IMMUTABLE STRICT
   AS $_$select $1 + $2;$_$;

-- Placeholder
INSERT INTO ${tableName} (name) VALUES ('Mr. T');
    

Limitations

  • No support for psql meta-commands with no Jdbc equivalent like \set
  • No support for ALTER TYPE ... ADD VALUE ... as this statement is an odd beast that can't run inside a transaction due to PostgreSQL limitations. There are workarounds available.
  • Multiline RULE declarations are not parsed correctly (Issue 183)
  • No support for EdbPlus-specific commands that have no JDBC equivalent (SET DEFINE OFF, ...)
  • No support for executing external scripts referenced with @other.script, as supported by EdbPlus

H2