Skip to content

JSPWIKI-1374 Make the PostgreSQL user database script run on PostgreSQL - #641

Open
arturobernalg wants to merge 1 commit into
apache:masterfrom
arturobernalg:fix-postgresql-ddl
Open

arturobernalg wants to merge 1 commit into
apache:masterfrom
arturobernalg:fix-postgresql-ddl

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

postgresql.ddl has never run on PostgreSQL: the column list of the users table ends with a comma and uses HSQL types (longvarchar, varchar_ignorecase), the commented out drops use the HSQL comment character, create user uses an option PostgreSQL no longer accepts, and the oldhashes column that JDBCUserDatabase writes is not defined (same gap as #639 for HSQL).

The e-mail column keeps the case insensitive comparison that findByEmail (WHERE email=?) relies on, through a non deterministic ICU collation, which needs PostgreSQL 12 or later. A citext column was tried first: the JDBC driver sends the e-mail as text and the comparison is then case sensitive.

Executed on PostgreSQL 16: the script runs without errors on an empty database and a second time on top of itself. As the jspwiki user, with the pgjdbc 42.7.13 driver, the INSERT of JDBCUserDatabase stores a user, SELECT * FROM users WHERE email=? finds it with the e-mail in other case, the UPDATE works and the admin role is read. On master the script fails on the users table.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant