Hi PG4WP Team,
I am creating a WordPress site using Postgres for database by using this plugin but unable to make connection between application and database.
Environment details are:
OS: Windows 2019
Server: IIS server
PHP: 8.0.1
WordPress (Latest): 6.1
Kindly drop me message here in post if there is any solution of it.
Thanks & Regards,
Sanjeev Mishra
No longer works at all with php-8.x (8.0, 8.1, etc). Fails to connect to the postgres database with tons of errors:
Automatic fetching of PostgreSQL connection is deprecated
Seems like this software is no longer being maintained by anyone?
]]>The function wpsql_fetch_field was not implemented in driver_pgsql.php:
function wpsql_fetch_field($result)
{ return 'tablename'; }
This is required, among other things, for the plug-in “wp-db-table-editor”
The following Q&D adjustment works for me:
class pg4fetch_field
{
public $name='empty';
public $type='';
}
function wpsql_fetch_field($result, $num)
{
$objekt=new pg4fetch_field();
$object->name = pg_field_name($result, $num);
$object->type = pg_field_type($result, $num);
return $object;
}
Note:
The type conversion is probably not correct, since (mysql/pg)_field_type returns a text and mysql_fetch_field returns a number
Hi!
While are using this plugin, I’ve a problem with editing pages.
In PG4WP logs I found this:
———————
[1606512645.3863] Error running :
SELECT p.ID FROM wp_posts p WHERE post_type=’scheduled-action’ AND p.post_status=’pending’ AND p.post_modified_gmt <= ‘2020-11-27 21:25:45′ AND p.post_password != ” ORDER BY p.post_date_gmt ASC LIMIT 0, 20
—- converted to —-
SELECT p.”ID” FROM wp_posts p WHERE post_type=’scheduled-action’ AND p.post_status=’pending’ AND p.post_modified_gmt <= ‘2020-11-27 21:25:45’ AND p.post_password <> 0 ORDER BY p.post_date_gmt ASC LIMIT 20 OFFSET 0
—-> ERROR: operator does not exist: character varying <> integer
LINE 1: …_gmt <= ‘2020-11-27 21:25:45’ AND p.post_password <> 0 ORDER…
^
HINT: No operator matches the given name and argument types. You might need to add explicit type casts.
———————
[1606512645.4773] Error running :
UPDATE wp_posts SET post_password = ‘c259d5877cdad7210992’, post_modified_gmt = ‘2020-11-27 21:30:45’, post_modified = ‘2020-11-27 22:30:45’ WHERE post_type = ‘scheduled-action’ AND post_status = ‘pending’ AND post_password = ” AND post_date_gmt <= ‘2020-11-27 21:30:45’ ORDER BY menu_order ASC, post_date_gmt ASC, ID ASC LIMIT 25
—- converted to —-
UPDATE wp_posts SET post_password = ‘c259d5877cdad7210992’, post_modified_gmt = ‘2020-11-27 21:30:45’, post_modified = ‘2020-11-27 22:30:45’ WHERE post_type = ‘scheduled-action’ AND post_status = ‘pending’ AND post_password = ” AND post_date_gmt <= ‘2020-11-27 21:30:45’ ORDER BY menu_order ASC, post_date_gmt ASC, ID ASC
—-> ERROR: syntax error at or near “ORDER”
LINE 1: …d = ” AND post_date_gmt <= ‘2020-11-27 21:30:45’ ORDER BY m…
^
———————
Any one have fix for that?
]]>I just updated to wordpress-5.5.1 and everything still works great!
]]>The so called “temporary fork” of this plugin, found here:
https://github.com/php4dev/heroku-wordpress/tree/master/wp-content/pg4wp
Works with WordPress 5.1 + WooCommerce 3.5.5
If, like me, you’re rusty on your PHP, make sure you enable Postgres support by uncommenting the line:
extension=php_pgsql.dll
in your php.ini
The location of php.ini will vary depending on whether you use xampp/wamp/lamp etc. A quick google should give you the answer.
Happy postgressing!
]]>The so called “temporary fork” of this plugin, found here:
https://github.com/kevinoid/postgresql-for-wordpress
Works with WordPress 4.9
If, like me, you’re rusty on your PHP, make sure you enable Postgres support by uncommenting the line:
extension=php_pgsql.dll
in your php.ini
The location of php.ini will vary depending on whether you use xampp/wamp/lamp etc. A quick google should give you the answer.
Happy postgressing!
]]>FYI, for anyone who wants to use PostgreSQL with a recent WordPress release, a fork of this plugin is available here:
https://github.com/kevinoid/postgresql-for-wordpress
I was able to install & use WordPress-4.8.1 with PostgreSQL-9.4.13 with zero problems. No install errors whatsoever.
]]>Hi …
My name is Marc Fournier, and I’ve been working on PostgreSQL since ’95 … I’ve recently been set the task of making WordPress work on PostgreSQL, and am using pg4wp as the foundation for this …
I’ve tried to reach out to Hawk about taking over the plugin itself, but heard nothing back, so suspect I may have to go the fork / new name route, but am not quite ready for that yet.
The work I’m doing right now is based on Trunk … specifically, getting the regression tests to pass, which is moving forward. My intention is to maintain against Trunk going forward, so that it won’t be a matter of catching up when each new release is made.
The new version will rely on https://pgxn.org/dist/mysqlcompat, which I’ve been handed the reins to … the ideas is that there is code that Hawk has been translating in driver_pgsql.php that can be easily done in the database itself, but, not only that, those database side aliases can benefit other projects that wish to migrate to a PostgreSQL backend.
Sadly, there is some MySQL-isms that can’t be done on the backend, so the translation process will still be required.
Although getting patches into Core to make it less MySQLcentric isn’t in the interest of the Core developers, they aren’t against minor patches that at least fix consistency: https://core.trac.www.ads-software.com/ticket/37903 … its one line, but hey, its a start.
As I said, I have no code to offer until the regression tests are working, which I’m spending my days working on right now, but hope to have something RSN.
Note, as I said above, I am working against Trunk for WordPress, but also 9.5 for PostgreSQL, and will be moving to 9.6 once it is released … but so far, I believe it should all work on older releases as well …
More to come …
]]>Howdy.
Two fixes I did to be able to install WordPress 4.4.2 at PostgreSQL 9.5:
1 – https://gist.github.com/rafaelbernard/67264a4d5b04714f82a1 (for @@SESSION.sql_mode)
2 – https://gist.github.com/rafaelbernard/0249b7b665562cbab080 (for SHOW FULL COLUMN statement)
Maybe someone else need .
Best regards.
Rafael
https://about.me/rafaelbernard
https://www.ads-software.com/plugins/postgresql-for-wordpress/
]]>Bonjour
PG4WP 1.3.1 – PG 9.3.10
After introducing the parameters of WP with PG4WP, I get many errors, for instance :
Erreur de la base de données WordPress : [ERROR: syntax error at or near “a” LINE 1: DELETE a, b FROM wp_options a, wp_options b ^]
DELETE a, b FROM wp_options a, wp_options b WHERE a.option_name LIKE ‘\_transient\_%’ AND a.option_name NOT LIKE ‘\_transient\_timeout\_%’ AND b.option_name = CONCAT( ‘_transient_timeout_’, SUBSTRING( a.option_name, 12 ) ) AND b.option_value < 1448550333
and
Erreur de la base de données WordPress : [ERROR: syntax error at or near “FULL” LINE 1: SHOW FULL COLUMNS FROM wp_options ^]
SHOW FULL COLUMNS FROMwp_options
Following, nothing is installed. But “Quel succès !” is sick humour.
Those SQL request are specific to mysql. The errors is “normal” as postgresql accept only standard SQL request.
What is the solution if any ?
Merci de l’aide.
https://www.ads-software.com/plugins/postgresql-for-wordpress/
]]>Since this project has been idle for a while, to address the often-reported issues with recent versions of WordPress, I have taken the time to fix the issues which are appearing on my own systems and post the patches in hopes that hawk__, or a future maintainer of this plugin, may find them useful for integrating. The patches are available in a branch on GitHub at:
https://github.com/kevinoid/postgresql-for-wordpress/compare/master…wordpress4-compat
I have attempted to provide log snippets with example queries that are failing in the commit message for each non-obvious change. Changes which are only necessary to support particular plugins are prefixed with the plugin name to make them easier to distinguish.
The patches may not fix all of the common issues in newer versions of WordPress, as they have only been tested on my mostly-archival installations. However, they should fix many of the common issues noted in recent support threads.
I hope you find them useful,
Kevin
https://www.ads-software.com/plugins/postgresql-for-wordpress/
]]>Hi, the data bse is created but it can be used o filled with initial data.
Anyone can fix this problem?
https://www.ads-software.com/plugins/postgresql-for-wordpress/
]]>Hello guys
I m newbie in wordpress. i just install wordpress 4.2.2. I want to install wordpress on heroku with postgresql. Before that i try to install wordpress with postgresql on my localhost. I follow the PG4WP installation steps but still my wordpress install with mysql database its not giving me option to install with postgresql.
https://www.ads-software.com/plugins/postgresql-for-wordpress/
]]>I use Nginx, PHP-FPM and Postgres 9.3, i’ve setting up postgres.conf to listen_addresses=’*’ and I still getting this message “Error establishing a database connection”
https://www.ads-software.com/plugins/postgresql-for-wordpress/
]]>how i update to wp 4.2.1? i can instal in wp3 but when i update says:
Warning: pg_query(): Query failed: ERROR: missing FROM-clause entry for table "session" LINE 1: SELECT @@SESSION.sql_mode ^ in /home/wgcv/www/php/wordpress/wp-content/pg4wp/driver_pgsql.php on line 136
WordPress
Database Update Required
WordPress has been updated! Before we send you on your way, we have to update your database to the newest version.
The update process may take a little while, so please be patient.
when i update says:
Warning: pg_query(): Query failed: ERROR: missing FROM-clause entry for table "session" LINE 1: SELECT @@SESSION.sql_mode ^ in /home/wgcv/www/php/wordpress/wp-content/pg4wp/driver_pgsql.php on line 136
WordPress
Catchable fatal error: Object of class WP_Error could not be converted to string in /home/wgcv/www/php/wordpress/wp-admin/includes/upgrade.php on line 1459
help me pls
https://www.ads-software.com/plugins/postgresql-for-wordpress/
]]>This SQL statement error:
SHOW FULL COLUMNS FROM $table
I think the driver_pgsql_install.php must be updated.
https://www.ads-software.com/plugins/postgresql-for-wordpress/
]]>Hello All,
I am thinking over using the plugin PG4WP and reading about I faced this:
“If you want to use this plugin, you should be aware of the following : – WordPress with PG4WP is expected to be slower than the original WordPress with MySQL because PG4WP does much SQL rewriting for any page view – Some WordPress plugins should work ‘out of the box’ but many plugins won’t because they would need specific code in PG4WP”
Is there anyone that has found performance issues when using the plugin in terms of DB speed?
Many thanks!
Mario
https://www.ads-software.com/plugins/postgresql-for-wordpress/
]]>Hi, there!
The PG4WP does not support wordpress 4.0.1 !!!!
Will it be an update?
THX.
https://www.ads-software.com/plugins/postgresql-for-wordpress/
]]>After upgrading to 1.3.1 I got a blank screen.
Wget told me Internal Server Error 500
and I could not access any admin stuff or anythning else.
Solution: Somehow the upgrade moves the postgres-plug-in folder from
wp-content/plugins/pg4wp
to
wp-content/plugins/postgresql-for-wordpress/pg4wp
I moved it back and all seems to work again.
https://www.ads-software.com/plugins/postgresql-for-wordpress/
]]>Having seen an update just last month is encouraging, but is this still being actively and proactively maintained? I fear that perhaps it is just being barely kept alive. A tool like this is most certainly invaluable and I think all of us would hate to see this fall by the wayside.
https://www.ads-software.com/plugins/postgresql-for-wordpress/
]]>I have installed the plugin WordPress for SEO for my blog and I noticed that the xml sitemaps were not properly being generated. Those that required to run an SQL query were returning a 404 Not Found page.
After searching the code for this module I found out that there was an improper query being propagated from the WordPress SEO plugin to PG4WP 1.3.1 which did the following :
SELECT COUNT(ID) FROM $wpdb->posts {$join_filter} WHERE post_status IN ('publish','inherit') AND post_password = '' AND post_author != 0 AND post_date != '0000-00-00 00:00:00' AND post_type = %s
The problem was that in SELECTS there wasn’t a proper sanitization for 0 ansi datetime.
I fixed it by adding at line 287-288 of driver_pgsql.php file :
after
if( false !== strpos( $sql, $wpdb->comments))
$sql = str_replace(' comment_id ', ' comment_ID ', $sql);
I added :
$sql = str_replace("'0000-00-00 00:00:00'", "'1970-01-01'", $sql);
See a detailed description of the error at my blog site here :
https://www.must-feed.com/2014/08/31/wordpress-seo-sitemap-heroku/
https://www.ads-software.com/plugins/postgresql-for-wordpress/
]]>Hello
I’ve found i can’t upload properly images that contains “ID” in any part of the filename.
I reviewed the driver code and i found some regexp replaces using ID but i wanted to keep you posted
https://www.ads-software.com/plugins/postgresql-for-wordpress/
]]>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://www.ads-software.com/plugins/postgresql-for-wordpress/
]]>I think it’s not working with wp 3.9 psql9.3 and nginx. Or I can’t get it to work i got an error in error.log:
LíNEA 1: SELECT @@SESSION.sql_mode
^ in /var/sites/example.com/www/wp-content/pg4wp/driver_pgsql.php on line 133
PHP message: PHP Fatal error: Call to undefined function wpsql_errno() in /var/sites/example.com/www/wp-content/pg4wp/core.php(32) : eval()’d code on line 1531″ while reading response header from upstream, client: XXX.XXX.XXX.XXX, server: example.com, request: “GET /wp-admin/install.php HTTP/1.1”, upstream: “fastcgi://unix:/var/run/php5-fpm.sock:”, host: “www.example.com”, referrer: “https://www.lostcitizen.net/wp-admin/setup-config.php?step=2”
Regards
]]>Attempting to use with 3.8 seems to mostly work, although immediately following installation I saw the following errors:
WordPress database error: [ERROR: syntax error at or near "a" LINE 1: DELETE a, b FROM wpyear5_options a, wpyear5_options b WHERE ^]
DELETE a, b FROM wpyear5_options a, wpyear5_options b WHERE a.option_name LIKE '\_transient\_%' AND a.option_name NOT LIKE '\_transient\_timeout\_%' AND b.option_name = CONCAT( '_transient_timeout_', SUBSTRING( a.option_name, 12 ) ) AND b.option_value < 1387862445
WordPress database error: [ERROR: syntax error at or near "a" LINE 1: DELETE a, b FROM wpyear5_options a, wpyear5_options b WHERE ^]
DELETE a, b FROM wpyear5_options a, wpyear5_options b WHERE a.option_name LIKE '\_site\_transient\_%' AND a.option_name NOT LIKE '\_site\_transient\_timeout\_%' AND b.option_name = CONCAT( '_site_transient_timeout_', SUBSTRING( a.option_name, 17 ) ) AND b.option_value < 1387862445
https://www.ads-software.com/plugins/postgresql-for-wordpress/
]]>Hi, is this plugin still working on recent versions? Did the bugs mentioned in the support thread get resolved? WordPress on PSQL is great, but hopefully it won’t fail after a couple of updates. Can I still rely on it? Thanks.
https://www.ads-software.com/plugins/postgresql-for-wordpress/
]]>Hi! And first of all, thanks for your work, PG4WP is really helpful for our project.
We built a website using apache + postgresql + WordPress + PG4WP + some home made plugins to get a members database.
When we insert or update a database field with text data containing “ID”, it gets quoted by the pg4wp driver. Ex: DAVID becomes “DAVID”.
We think that the field get changed at the line 434 of the driver:
// Field names with CAPITALS need special handling
if( false !== strpos($sql, 'ID') && false === strpos($sql, '/*+NO_PARSE */'))
{
$pattern = '/ID([^ ])/';
$sql = preg_replace($pattern, 'ID $1', $sql);
$pattern = '/ID$/';
$sql = preg_replace($pattern, 'ID ', $sql);
$pattern = '/\(ID/';
$sql = preg_replace($pattern, '( ID', $sql);
$pattern = '/,ID/';
$sql = preg_replace($pattern, ', ID', $sql);
<strong>$pattern = '/[0-9a-zA-Z_]+ID/';
$sql = preg_replace($pattern, '"$0"', $sql);</strong>
$pattern = '/\.ID/';
$sql = preg_replace($pattern, '."ID"', $sql);
$pattern = '/[\s]ID /';
$sql = preg_replace($pattern, ' "ID" ', $sql);
$pattern = '/"ID "/';
$sql = preg_replace($pattern, ' "ID" ', $sql);
} // CAPITALS
You can see that we tried to put a conditional comment in the sql query to don’t get parsed. But this didn’t solved our problem.
The SQL code in our plugin is native Postgresql. Unfortunately, I can’t give you a test access to our site.
We don’t really understand why do you need to do a conversion when you find an “ID” string. If you could explain a little bit the utility of this, we could find an solution to our code. Or maybe a way to say to the driver that our code is native postgresql code and don’t try to do any replacement on it (like our try to do conditional comments).
It’s messing with a large number of queries. Selects, Inserts and Updates.
Like this one:
SELECT /*+NO_PARSE */ wp_u_membres_principal(%d,%d,%d,%s,%s,%s,%s,%s,%s,%d,%s,%s,%s,%s,%s,%s,%s,%s,%d) as histo_membres_id
or this one:
$stmt = select * from [prefix]s_membres_actifs() [test-supplementaire] order by nom,prenoms;
$stmt = str_replace("[prefix]", $wpdb->prefix, $stmt);
$stmt = str_replace("[test-supplementaire]", " where date_de_deces is null and annee_de_deces is null and mois_de_deces is null and sans_date_de_deces is null".($nom_membre == "" ? "" : " and nom like %s"), $stmt);
$sql = $wpdb->prepare($stmt,($nom_membre == "" ? null : "%".$nom_membre."%"));
https://www.ads-software.com/extend/plugins/postgresql-for-wordpress/
]]>Hello,
Is there a way to migrate an existing MySQL database (or a dump of it) and import that data to a Postgres one?
In other words, can this plugin be used (even with a little hacking) for existing WordPress installations or is it exclusively for new ones?
Thanks in advance
https://www.ads-software.com/extend/plugins/postgresql-for-wordpress/
]]>Any suggestions for generic “Error establishing a database connection” error?
WP 3.5.1
PostgreSQL for WordPress 1.3.0
PostgreSQL 8.4.13
PHP 5.3.23
https://www.ads-software.com/extend/plugins/postgresql-for-wordpress/
]]>