From 3c39d818edc9a9c4053492a520c0b7f51abd2d56 Mon Sep 17 00:00:00 2001 From: Arturo Bernal Date: Tue, 17 Nov 2026 11:04:39 +0100 Subject: [PATCH] JSPWIKI-1374 Make the PostgreSQL user database script run on PostgreSQL The script ended the column list of the users table with a comma and used HSQL types, so the table was not created. It also used the HSQL comment character and an option of create user that PostgreSQL no longer accepts, and it did not define the oldhashes column. The e-mail column is compared ignoring case, as the lookup of JDBCUserDatabase needs, through a non deterministic collation; a citext column is compared as text by the JDBC driver and does not do that. --- ChangeLog.md | 6 ++++++ .../java/org/apache/wiki/api/Release.java | 2 +- jspwiki-war/src/main/config/db/postgresql.ddl | 20 +++++++++++-------- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 880da8f4df..830b9ee1fb 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -17,6 +17,12 @@ specific language governing permissions and limitations under the License. --> +**2026-11-17 Arturo Bernal (abernal AT apache DOT org)** + +* _3.0.1-git-10_ + +* Fix for [JSPWIKI-1374](https://issues.apache.org/jira/browse/JSPWIKI-1374): the PostgreSQL script that creates the user database tables runs on PostgreSQL + **2026-11-14 Multiple authors** * _3.0.1-git-09 diff --git a/jspwiki-api/src/main/java/org/apache/wiki/api/Release.java b/jspwiki-api/src/main/java/org/apache/wiki/api/Release.java index 7128b9933e..a588475922 100644 --- a/jspwiki-api/src/main/java/org/apache/wiki/api/Release.java +++ b/jspwiki-api/src/main/java/org/apache/wiki/api/Release.java @@ -69,7 +69,7 @@ public final class Release { *

* If the build identifier is empty, it is not added. */ - public static final String BUILD = "9"; + public static final String BUILD = "10"; /** * This is the generic version string you should use when printing out the version. It is of diff --git a/jspwiki-war/src/main/config/db/postgresql.ddl b/jspwiki-war/src/main/config/db/postgresql.ddl index fe1e85e39b..c37caef05d 100644 --- a/jspwiki-war/src/main/config/db/postgresql.ddl +++ b/jspwiki-war/src/main/config/db/postgresql.ddl @@ -18,9 +18,12 @@ drop table groups; drop table group_members; drop user jspwiki; +-- the e-mail of a user is looked up with the case the user typed, as varchar_ignorecase does on HSQL +create collation if not exists case_insensitive (provider = icu, locale = 'und-u-ks-level2', deterministic = false); + create table users ( uid varchar(100), - email varchar_ignorecase(100), + email varchar(100) collate case_insensitive, full_name varchar(100), login_name varchar(100) not null primary key, password varchar(255), @@ -29,7 +32,8 @@ create table users ( modified timestamp, lock_expiry timestamp, password_changed timestamp, - attributes longvarchar, + attributes text, + oldhashes text ); create table roles ( @@ -52,7 +56,7 @@ create table group_members ( primary key (name,member) ); -create user jspwiki with encrypted password 'password' nocreatedb nocreateuser; +create user jspwiki with encrypted password 'password' nosuperuser nocreatedb nocreaterole; grant select, insert, update, delete on users to jspwiki; grant select, insert, update, delete on roles to jspwiki; @@ -101,8 +105,8 @@ insert into group_members ( 'Administrator' ); -#drop table users; -#drop table roles; -#drop table groups; -#drop table group_members; -#drop user jspwiki; +--drop table users; +--drop table roles; +--drop table groups; +--drop table group_members; +--drop user jspwiki;