PostgreSQL-For-Wordpress / postgresql-for-wordpress

A maintained fork of https://wordpress.org/plugins/postgresql-for-wordpress/
GNU General Public License v2.0
209 stars 68 forks source link

Test / Fix Relevanssi plugin and add to list of supported plugins #78

Open mattbucci opened 8 months ago

mattbucci commented 8 months ago

https://wordpress.org/plugins/relevanssi/

Not working per: https://github.com/PostgreSQL-For-Wordpress/postgresql-for-wordpress/issues/73

hahnn commented 4 months ago

Tested and still not working because of the below SQL error:

[1710090580.6647] Error running :
CREATE TABLE wp_relevanssi (doc bigint(20) NOT NULL DEFAULT '0',
        term varchar(50) NOT NULL DEFAULT '0',
        term_reverse varchar(50) NOT NULL DEFAULT '0',
        content mediumint(9) NOT NULL DEFAULT '0',
        title mediumint(9) NOT NULL DEFAULT '0',
        comment mediumint(9) NOT NULL DEFAULT '0',
        tag mediumint(9) NOT NULL DEFAULT '0',
        link mediumint(9) NOT NULL DEFAULT '0',
        author mediumint(9) NOT NULL DEFAULT '0',
        category mediumint(9) NOT NULL DEFAULT '0',
        excerpt mediumint(9) NOT NULL DEFAULT '0',
        taxonomy mediumint(9) NOT NULL DEFAULT '0',
        customfield mediumint(9) NOT NULL DEFAULT '0',
        mysqlcolumn mediumint(9) NOT NULL DEFAULT '0',
        taxonomy_detail longtext NOT NULL,
        customfield_detail longtext NOT NULL DEFAULT '',
        mysqlcolumn_detail longtext NOT NULL DEFAULT '',
        type varchar(210) NOT NULL DEFAULT 'post',
        item bigint(20) NOT NULL DEFAULT '0',
        PRIMARY KEY doctermitem (doc, term, item)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci
---- converted to ----
CREATE TABLE IF NOT EXISTS wp_relevanssi (doc bigint NOT NULL DEFAULT '0',
        term varchar(50) NOT NULL DEFAULT '0',
        term_reverse varchar(50) NOT NULL DEFAULT '0',
        content mediumint NOT NULL DEFAULT '0',
        title mediumint NOT NULL DEFAULT '0',
        comment mediumint NOT NULL DEFAULT '0',
        tag mediumint NOT NULL DEFAULT '0',
        link mediumint NOT NULL DEFAULT '0',
        author mediumint NOT NULL DEFAULT '0',
        category mediumint NOT NULL DEFAULT '0',
        excerpt mediumint NOT NULL DEFAULT '0',
        taxonomy mediumint NOT NULL DEFAULT '0',
        customfield mediumint NOT NULL DEFAULT '0',
        mysqlcolumn mediumint NOT NULL DEFAULT '0',
        taxonomy_detail text NOT NULL,
        customfield_detail text NOT NULL DEFAULT '',
        mysqlcolumn_detail text NOT NULL DEFAULT '',
        type varchar(210) NOT NULL DEFAULT 'post',
        item bigint NOT NULL DEFAULT '0',
        PRIMARY KEY doctermitem (doc, term, item));
----> ERREUR:  erreur de syntaxe sur ou près de « doctermitem »
LINE 20:  PRIMARY KEY doctermitem (doc, term, item));
                      ^
---------------------

Here there is clearly an issue of conversion about the PRIMARY KEY. In fact, if a name is given to the primary key in the same SL instruction where we have the CREATE TABLE, this name should be removed. So instead of having this:

PRIMARY KEY doctermitem (doc, term, item));

We should have that:

PRIMARY KEY (doc, term, item));

The second issue is the data type mediumint which is not existing in PostgreSQL, that we can see several times here. mediumint is a very strange thing invented in MySQL, to represent an integer on 3 bytes (instead of 2 or 4).

It must be replaced by the integer PostgreSQL data type.