Support » Plugin: PostgreSQL for WordPress (PG4WP) » Not working with 3.9

  • Hello there,

    I tried the 3.9 version today and i’m getting those errors :

    Warning: mysqli_real_connect(): (28000/1045): Access denied for user ‘postgres’@’localhost’ (using password: YES) in /var/www/shop/wp-content/pg4wp/core.php(32) : eval()’d code on line 1342

    Warning: Missing argument 3 for wpsql_result(), called in /var/www/shop/wp-content/pg4wp/core.php(32) : eval()’d code on line 755 and defined in /var/www/shop/wp-content/pg4wp/driver_pgsql.php on line 58

    Notice: Undefined variable: fieldname in /var/www/shop/wp-content/pg4wp/driver_pgsql.php on line 59

    Warning: pg_fetch_result() expects parameter 1 to be resource, boolean given in /var/www/shop/wp-content/pg4wp/driver_pgsql.php on line 59

    Notice: Trying to get property of non-object in /var/www/shop/wp-content/pg4wp/driver_pgsql.php on line 271

    Notice: Trying to get property of non-object in /var/www/shop/wp-content/pg4wp/driver_pgsql.php on line 285

    Warning: pg_query(): Query failed: ERROR: missing FROM-clause entry for table “session” LINE 1: SELECT @@SESSION.sql_mode ^ in /var/www/shop/wp-content/pg4wp/driver_pgsql.php on line 133

    Any upgrade soon or idea how I can correct this ?

    Thanks

    https://wordpress.org/plugins/postgresql-for-wordpress/

Viewing 14 replies - 1 through 14 (of 14 total)
  • Hi!
    I’ve the same problem.
    I corrected some errors with this http://wordpress.org/support/topic/not-working-with-39 but I’ve Warning: Missing argument 3 for wpsql_result(), called in /www/web/wp-content/pg4wp/core.php(32) : eval()'d code on line 755 and defined in /www/web/wp-content/pg4wp/driver_pgsql.php on line 58 yet.

    @sbanchero: It is considered impolite to interrupt another poster’s ongoing thread unless you are posting a solution or suggestion. As per the Forum Welcome, please post your own topic.

    I thought that perhaps this could help him as my.
    I’m sorry!!

    No problem,

    I ‘ve seen the other topic but it does not correct errors.

    Is the author of the plugin still around ?

    It’m getting worried…

    Hi

    Edit the function wp-content/pg4wp/driver_pgsql.php on line 58 with :

    function wpsql_result($result, $i, $fieldname = null) {
    		if (is_resource($result)) {
    			if ($fieldname) {
    				return pg_fetch_result($result, $i, $fieldname);
    			} else {
    				return pg_fetch_result($result, $i);
    			}
    		}
    	}

    Hi !

    thanks falydev for your help. Your code solved some errors but not all of them.

    Now I have :

    Warning: mysqli_real_connect(): (28000/1045): Access denied for user 'postgres'@'localhost' (using password: YES) in /var/www/shop/wp-content/pg4wp/core.php(32) : eval()'d code on line 1342
    
    Notice: Trying to get property of non-object in /var/www/shop/wp-content/pg4wp/driver_pgsql.php on line 278
    
    Notice: Trying to get property of non-object in /var/www/shop/wp-content/pg4wp/driver_pgsql.php on line 292
    
    Warning: pg_query(): Query failed: ERROR: missing FROM-clause entry for table "session" LINE 1: SELECT @@SESSION.sql_mode ^ in /var/www/shop/wp-content/pg4wp/driver_pgsql.php on line 140

    Am I the only one to have this errors ?

    Thanks for sharing this hack, falydev, compiled this with another step related to the wpsql_errno in my blog so you normally have all the needed tweaks to make WordPress 3.9.1 work on a Postgresql database.

    I’ve tested installing and creating/modifying content successfully. Be careful to make extended tests if you have extensions (that I don’t use).

    vitorio

    Thx, all this tweaks working well =)

    I’m trying to install wordpress-3.9.3 using PGWP-1.3.1, and I’m also seeing this error:

    PHP Warning:  pg_query(): Query failed: ERROR:  missing FROM-clause entry for table "session"\nLINE 1: SELECT @@SESSION.sql_mode\n                 ^ in /var/www/html/year6/wp-content/pg4wp/driver_pgsql.php on line 136

    Anyone know how to solve it?

    Disclaimer: I’m not using WordPress 3.9.3 by the moment, this is a theoretical solution based on my lecture of the code and generated error. Use it at your own risk. Use a test setup and test all functions you need before deploying this patch in a production!

    SESSION.sql_mode is a way of getting the settings of MySQL. This won’t work on Postgresql.
    You can try to bypass this check by modifying the file wp-includes/wp-db.php line 737:
    [code] if ( $this->use_mysqli ) {
    $res = mysqli_query( $this->dbh, 'SELECT @@SESSION.sql_mode' );
    } else {
    $res = mysql_query( 'SELECT @@SESSION.sql_mode', $this->dbh );
    }
    [/code]
    Comment this code and change it by $res = “”; as following:
    [code]/* if ( $this->use_mysqli ) {
    $res = mysqli_query( $this->dbh, 'SELECT @@SESSION.sql_mode' );
    } else {
    $res = mysql_query( 'SELECT @@SESSION.sql_mode', $this->dbh );
    }*/
    $res = "";
    [/code]

    Let me know if this solves your problem 🙂

    Thanks @vitorio. I made the changes that you suggested, and I’m no longer seeing the error. However, I’m seeing “Error establishing a database connection” in my web browser, with no errors logged anywhere else that I can find.

    Hmmm, so it’s more complicated than this.
    Did you try with newer versions of WordPress, like the 4.1?
    I’ll also have to face this problem at the begin of the year, upgrading our website. By the moment I’m on holidays.

    With some chance, Hawkix will deliver us something functional until there 🙂

    Unfortunately, PG4WP have to be consider a hack, and not a stable plugin. A little bit like jailbreaks. It won’t provide a 100% compatibility and not necessarily work with all versions. When you find a WordPress version that works well for your needs, keep it. Same for the extensions. PG4WP introduces fragility in updates, as core developers don’t officially support this code. So be aware and always test your updates in a pre-prod environment.

    I tried WP-4.1, but that also fails with the same “Error establishing a database connection” error.

    I am using wp v.3.9.2 with pg4wp v.1.3.1.

    Still got the following output:

    Warning: mysqli_real_connect(): (HY000/1045): Access denied for user 'bema'@'localhost' (using password: YES) in /var/www/public/wp-content/pg4wp/core.php(32) : eval()'d code on line 1342
    
    Notice: Trying to get property of non-object in /var/www/public/wp-content/pg4wp/driver_pgsql.php on line 274
    
    Notice: Trying to get property of non-object in /var/www/public/wp-content/pg4wp/driver_pgsql.php on line 288
    
    Warning: pg_query(): Query failed: ERROR: missing FROM-clause entry for table "session" LINE 1: SELECT @@SESSION.sql_mode ^ in /var/www/public/wp-content/pg4wp/driver_pgsql.php on line 136

    Any help is apprecieted!

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Not working with 3.9’ is closed to new replies.