New Oracle-Compatibility features in PostgresPlus Advanced Server 9.3Beta

In short about EnterpriseDB product PostgresPlus Advanced Server, its built upon PostgreSQL community version with Oracle-Compatibility features and its ability to run with existing Oracle applications without any re-coding(typically required in migration) and allow enterprises to enjoy the benefit of the Open source database with PostgresPlus Advanced Server.

As PostgresPlus Advanced Server 9.3 Beta built upon community PostgreSQL 9.3 Beta feature, thence varied Oracle-Compatiblity features introduced in BETA unleash, like Oracle-style syntaxes, packages, SQL function etc. Below are few of the examples executed in PPAS 9.3 BETA:-

Materialized Views Syntax:

CREATE MATERIALIZED VIEW name [build_clause][create_mv_refresh] AS subquery
Where build_clause is:
BUILD {IMMEDIATE | DEFERRED}
Where create_mv_refresh is:
REFRESH [COMPLETE] [ON DEMAND]

  • Build deferred – In this option, data not populated in MV at the creation time, instead its populate later by using REFRESH MATERIALIZED VIEW.
  • Build Immediate – In this option, data populated in MV at the creation time from tables (Default)

edb=# create materialized view mymview1 
build immediate
as select ename,sum(sal) from emp group by ename;
SELECT 14
edb=# create materialized view mymview2
build deferred
as select ename,sum(sal) from emp group by ename;
SELECT 0

As you’ll be able to figure it out from above output that “BUILD IMMEDIATE” populates all rows at the create time, whereas “BUILD DEFERRED” simply created a dummy object that ought to be later populated using REFRESH MATERIALIZED VIEW.

edb=# refresh materialized view mymview2 ;
REFRESH MATERIALIZED VIEW
edb=# select count(*) from mymview2;
count
-------
14
(1 row)

REFRESH [COMPLETE] [ON DEMAND] modes are also supported at creation time of Materialized View.

More Oracle SQL functions support:
REGEXP_SUBSTR()

edb=# SELECT REGEXP_SUBSTR('EDB documentation AT http://www.enterprisedb.com/','http://([[:alnum:]]+){3,4}/?') as RESULT FROM dual;
result
------------
http://www
(1 row)

REGEXP_COUNT()

edb=# select regexp_count('I am in PG-Mailing list','i',1,'i');
regexp_count
--------------
5
(1 row)

REGEXP_INSTR()

edb=# SELECT REGEXP_INSTR('PostgreSQL','P') "position" FROM dual;
position
----------
1
(1 row)

RAWTOHEX() / HEXTORAW ()

edb=# CREATE TABLE test (raw_col RAW(10));
CREATE TABLE
edb=# INSERT INTO test VALUES (HEXTORAW('7D'));
INSERT 0 1
edb=# select * from test ;
raw_col
---------
x7d
(1 row)

edb=# select rawtohex(raw_col) from test ;
rawtohex
----------
7d
(1 row)

More Oracle Packages support:

DBMS_SCHEDULER
DBMS_RANDOM
DBMS_CRYPTO
DBMS_MVIEW
DBMS_LOCK.sleep
UTL_HTTP
UTL_ENCODE
UTL_URL

For more details you can refer release notes:
http://get.enterprisedb.com/releasenotes/PgPlus_AS_93Beta1_Release_Notes_20130802.pdf

–Raghav