diff --git a/config/alfresco/dbscripts/create/3.2/org.hibernate.dialect.MySQLInnoDBDialect/AlfrescoPostCreate-3.2-Indexes.sql b/config/alfresco/dbscripts/create/3.2/org.hibernate.dialect.Dialect/AlfrescoPostCreate-3.2-Indexes.sql
similarity index 100%
rename from config/alfresco/dbscripts/create/3.2/org.hibernate.dialect.MySQLInnoDBDialect/AlfrescoPostCreate-3.2-Indexes.sql
rename to config/alfresco/dbscripts/create/3.2/org.hibernate.dialect.Dialect/AlfrescoPostCreate-3.2-Indexes.sql
diff --git a/config/alfresco/dbscripts/upgrade/2.2/org.hibernate.dialect.Dialect/AlfrescoSchemaUpdate-Person.sql b/config/alfresco/dbscripts/upgrade/2.2/org.hibernate.dialect.Dialect/AlfrescoSchemaUpdate-Person.sql
index 6d0e659ece..be5a6b9382 100644
--- a/config/alfresco/dbscripts/upgrade/2.2/org.hibernate.dialect.Dialect/AlfrescoSchemaUpdate-Person.sql
+++ b/config/alfresco/dbscripts/upgrade/2.2/org.hibernate.dialect.Dialect/AlfrescoSchemaUpdate-Person.sql
@@ -63,5 +63,5 @@ INSERT INTO alf_applied_patch
VALUES
(
'patch.db-V2.2-Person-3', 'Manually executed script upgrade V2.2: Person user name also in the association qname',
- 0, 3002, -1, 3003, null, 'UNKOWN', 1, 1, 'Script completed'
+ 0, 3002, -1, 3003, null, 'UNKOWN', ${TRUE}, ${TRUE}, 'Script completed'
);
diff --git a/config/alfresco/dbscripts/upgrade/2.2/org.hibernate.dialect.PostgreSQLDialect/AlfrescoSchemaUpdate-Person.sql b/config/alfresco/dbscripts/upgrade/2.2/org.hibernate.dialect.PostgreSQLDialect/AlfrescoSchemaUpdate-Person.sql
deleted file mode 100644
index 84c806a854..0000000000
--- a/config/alfresco/dbscripts/upgrade/2.2/org.hibernate.dialect.PostgreSQLDialect/AlfrescoSchemaUpdate-Person.sql
+++ /dev/null
@@ -1,67 +0,0 @@
---
--- Title: Move user name to be part of the association QNAME
--- Database: PostgreSQL
--- Since: V2.2 Schema 91
--- Author: Andy Hind
---
--- Please contact support@alfresco.com if you need assistance with the upgrade.
---
--- Path was previously unused and unindex - new we use it the index is required.
-
-UPDATE
- alf_child_assoc
- SET
- qname_ns_id =
- (
- SELECT
- id
- FROM
- alf_namespace n
- WHERE
- n.uri = 'http://www.alfresco.org/model/content/1.0'
- ),
- qname_localname =
- (
- SELECT
- LOWER(p.string_value)
- FROM
- alf_node_properties p
- JOIN alf_qname q on p.qname_id = q.id
- JOIN alf_namespace n on q.ns_id = n.id
- WHERE
- p.node_id = alf_child_assoc.child_node_id AND
- q.local_name ='userName' AND
- n.uri = 'http://www.alfresco.org/model/content/1.0'
- )
- WHERE exists
- (
- SELECT
- 0
- FROM alf_node_properties pp
- JOIN alf_qname qq on pp.qname_id = qq.id
- JOIN alf_namespace nn on qq.ns_id = nn.id
- WHERE
- pp.node_id = alf_child_assoc.child_node_id AND
- qq.local_name ='userName' AND
- nn.uri = 'http://www.alfresco.org/model/content/1.0'
- )
-;
-
--- Validation query
--- select count(*) from alf_child_assoc c
--- JOIN alf_node_properties pp ON c.child_node_id = pp.node_id AND c.qname_localname = pp.string_value
--- JOIN alf_qname qq on pp.qname_id = qq.id
--- JOIN alf_namespace nn on qq.ns_id = nn.id AND c.qname_ns_id = nn.id
--- WHERE qq.local_name ='userName' AND nn.uri = 'http://www.alfresco.org/model/content/1.0'
-
---
--- Record script finish
---
-DELETE FROM alf_applied_patch WHERE id = 'patch.db-V2.2-Person-3';
-INSERT INTO alf_applied_patch
- (id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
- VALUES
- (
- 'patch.db-V2.2-Person-3', 'Manually executed script upgrade V2.2: Person user name also in the association qname',
- 0, 2005, -1, 2006, null, 'UNKNOWN', TRUE, TRUE, 'Script completed'
- );
diff --git a/config/alfresco/ibatis/org.hibernate.dialect.PostgreSQLDialect/activities-insert-SqlMap.xml b/config/alfresco/ibatis/org.hibernate.dialect.PostgreSQLDialect/activities-insert-SqlMap.xml
new file mode 100644
index 0000000000..9e8df5f455
--- /dev/null
+++ b/config/alfresco/ibatis/org.hibernate.dialect.PostgreSQLDialect/activities-insert-SqlMap.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+ select nextVal('alf_activity_feed_control_seq')
+
+
+ insert into alf_activity_feed_control (id, feed_user_id, site_network, app_tool, last_modified)
+ values (#id#, #feedUserId#, #siteNetwork#, #appTool#, #lastModified#)
+
+
+
+
+
+
+ select nextVal('alf_activity_feed_seq')
+
+
+ insert into alf_activity_feed (id, activity_type, activity_summary, activity_format, feed_user_id, post_user_id, post_date, post_id, site_network, app_tool, feed_date)
+ values (#id#, #activityType#, #activitySummary#, #activitySummaryFormat#, #feedUserId#, #postUserId#, #postDate#, #postId#, #siteNetwork#, #appTool#, #feedDate#)
+
+
+
+
+
+
+ select nextVal('alf_activity_post_seq')
+
+
+ insert into alf_activity_post (sequence_id, status, activity_data, post_user_id, post_date, activity_type, site_network, app_tool, job_task_node, last_modified)
+ values (#id#, #status#, #activityData#, #userId#, #postDate#, #activityType#, #siteNetwork#, #appTool#, #jobTaskNode#, #lastModified#)
+
+
+
+
\ No newline at end of file
diff --git a/config/alfresco/ibatis/org.hibernate.dialect.PostgreSQLDialect/audit-insert-SqlMap.xml b/config/alfresco/ibatis/org.hibernate.dialect.PostgreSQLDialect/audit-insert-SqlMap.xml
new file mode 100755
index 0000000000..45d0121968
--- /dev/null
+++ b/config/alfresco/ibatis/org.hibernate.dialect.PostgreSQLDialect/audit-insert-SqlMap.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+ select nextVal('alf_audit_model_seq')
+
+
+ insert into alf_audit_model (id, content_data_id, content_crc)
+ values (#id#, #contentDataId#, #contentCrc#)
+
+
+
+
+
+
+ select nextVal('alf_audit_app_seq')
+
+
+ insert into alf_audit_app (id, version, app_name_id, audit_model_id, disabled_paths_id)
+ values (#id#, #version#, #applicationNameId#, #auditModelId#, #disabledPathsId#)
+
+
+
+
+
+
+ select nextVal('alf_audit_entry')
+
+
+ insert into alf_audit_entry (id, audit_app_id, audit_user_id, audit_time, audit_values_id)
+ values (#id#, #auditApplicationId#, #auditUserId#, #auditTime#, #auditValuesId#)
+
+
+
+
\ No newline at end of file
diff --git a/config/alfresco/ibatis/org.hibernate.dialect.PostgreSQLDialect/avm-insert-SqlMap.xml b/config/alfresco/ibatis/org.hibernate.dialect.PostgreSQLDialect/avm-insert-SqlMap.xml
new file mode 100755
index 0000000000..a6919cc645
--- /dev/null
+++ b/config/alfresco/ibatis/org.hibernate.dialect.PostgreSQLDialect/avm-insert-SqlMap.xml
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select nextVal('avm_stores_seq')
+
+
+ insert into avm_stores (id, next_version_id, name, vers, current_root_id, acl_id)
+ values (#id#, #version#, #name#, 0, null, null)
+
+
+
+
+
+
+ select avm_store_properties_seq.nextval as value from dual
+
+
+ insert into avm_store_properties (id, actual_type_n, persisted_type_n, multi_valued, boolean_value, long_value, float_value, double_value, string_value, serializable_value, avm_store_id, qname_id)
+ values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
+
+
+
+
+
+
+ select nextVal('avm_nodes_seq')
+
+
+ insert into avm_nodes (id, class_type, deletedType, version_id, vers, store_new_id, acl_id, guid, owner, creator, createDate, lastModifier, modDate, accessDate, is_root, layer_id, indirection, indirection_version, primary_indirection, opacity, content_url, mime_type, encoding, length)
+ values (#id#, #classType#, #deletedType#, #version#, 0, #storeNewId#, #aclId#, #guid#, #owner#, #creator#, #createdDate#, #modifier#, #modifiedDate#, #accessDate#, #isRoot#, #layerId#, #indirection#, #indirectionVersion#, #primaryIndirection#, #opacity#, #contentUrl#, #mimetype#, #encoding#, #length#)
+
+
+
+
+
+
+ select nextVal('avm_version_roots_seq')
+
+
+ insert into avm_version_roots (id, avm_store_id, root_id, version_id, creator, create_date, tag, description)
+ values (#id#, #storeId#, #rootNodeId#, #version#, #creator#, #createdDate#, #tag#, #description#)
+
+
+
+
\ No newline at end of file
diff --git a/config/alfresco/ibatis/org.hibernate.dialect.PostgreSQLDialect/content-insert-SqlMap.xml b/config/alfresco/ibatis/org.hibernate.dialect.PostgreSQLDialect/content-insert-SqlMap.xml
new file mode 100755
index 0000000000..ddb383377e
--- /dev/null
+++ b/config/alfresco/ibatis/org.hibernate.dialect.PostgreSQLDialect/content-insert-SqlMap.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+ select nextVal('alf_mimetype_seq')
+
+
+ insert into alf_mimetype (id, version, mimetype_str)
+ values (#id#, #version#, lower(#mimetype#))
+
+
+
+
+
+
+ select nextVal('alf_encoding_seq')
+
+
+ insert into alf_encoding (id, version, encoding_str)
+ values (#id#, #version#, lower(#encoding#))
+
+
+
+
+
+
+ select nextVal('alf_content_url_seq')
+
+
+ insert into alf_content_url (id, version, content_url, content_url_short, content_url_crc, content_size)
+ values (#id#, #version#, #contentUrl#, #contentUrlShort#, #contentUrlCrc#, #size#)
+
+
+
+
+
+
+ select nextVal('alf_content_data_seq')
+
+
+ insert into alf_content_data (id, version, content_url_id, content_mimetype_id, content_encoding_id, content_locale_id)
+ values (#id#, #version#, #contentUrlId#, #mimetypeId#, #encodingId#, #localeId#)
+
+
+
+
diff --git a/config/alfresco/ibatis/org.hibernate.dialect.PostgreSQLDialect/locks-insert-SqlMap.xml b/config/alfresco/ibatis/org.hibernate.dialect.PostgreSQLDialect/locks-insert-SqlMap.xml
new file mode 100755
index 0000000000..80c12ad1da
--- /dev/null
+++ b/config/alfresco/ibatis/org.hibernate.dialect.PostgreSQLDialect/locks-insert-SqlMap.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+ select nextVal('alf_lock_resource_seq')
+
+
+ insert into alf_lock_resource (id, version, qname_ns_id, qname_localname)
+ values (#id#, #version#, #qnameNamespaceId#, lower(#qnameLocalName#))
+
+
+
+
+
+
+ select nextVal('alf_lock_seq')
+
+
+ insert into alf_lock (id, version, shared_resource_id, excl_resource_id, lock_token, start_time, expiry_time)
+ values (#id#, #version#, #sharedResourceId#, #exclusiveResourceId#, lower(#lockToken#), #startTime#, #expiryTime#)
+
+
+
+
\ No newline at end of file
diff --git a/config/alfresco/ibatis/org.hibernate.dialect.PostgreSQLDialect/propval-insert-SqlMap.xml b/config/alfresco/ibatis/org.hibernate.dialect.PostgreSQLDialect/propval-insert-SqlMap.xml
new file mode 100755
index 0000000000..fde6af82da
--- /dev/null
+++ b/config/alfresco/ibatis/org.hibernate.dialect.PostgreSQLDialect/propval-insert-SqlMap.xml
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
+
+ select nextVal('alf_prop_class_seq')
+
+
+ insert into alf_prop_class (id, java_class_name, java_class_name_short, java_class_name_crc)
+ values (#id#, #javaClassName#, #javaClassNameShort#, #javaClassNameCrc#)
+
+
+
+
+
+ select nextVal('alf_prop_string_value_seq')
+
+
+ insert into alf_prop_string_value (id, string_value, string_end_lower, string_crc)
+ values (#id#, #stringValue#, #stringEndLower#, #stringCrc#)
+
+
+
+
+
+
+ select nextVal('alf_prop_double_value_seq')
+
+
+ insert into alf_prop_double_value (id, double_value)
+ values (#id#, #doubleValue#)
+
+
+
+
+
+
+ select nextVal('alf_prop_serializable_value_seq')
+
+
+ insert into alf_prop_serializable_value (id, serializable_value)
+ values (#id#, #serializableValue#)
+
+
+
+
+
+
+ select nextVal('alf_prop_value_seq')
+
+
+ insert into alf_prop_value (id, actual_type_id, persisted_type, long_value)
+ values (#id#, #actualTypeId#, #persistedType#, #longValue#)
+
+
+
+
+
+
+ select nextVal('alf_prop_root_seq')
+
+
+ insert into alf_prop_root (id, version)
+ values (#id#, #version#)
+
+
+
+
+
+
+ select nextVal('alf_prop_unique_ctx_seq')
+
+
+ insert into alf_prop_unique_ctx (id, version, value1_prop_id, value2_prop_id, value3_prop_id)
+ values (#id#, #version#, #value1PropId#, #value2PropId#, #value3PropId#)
+
+
+
+
\ No newline at end of file