Files
postgresql-for-wordpress/pg4wp
Kevin Locke 935a99c429 Rewrite multi-table delete of wp_options
During schema upgrade, populate_options() deletes all expired transients
and their corresponding transient timeouts.  The queries produce the
following errors:

Error running :
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 < 1433110465
---- converted to ----
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 < 1433110465
----> ERROR:  syntax error at or near "a"
LINE 1: DELETE a, b FROM wp_options a, wp_options b
               ^
---------------------
Error running :
DELETE a, b FROM wp_options a, wp_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 < 1433110465
---- converted to ----
DELETE a, b FROM wp_options a, wp_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 < 1433110465
----> ERROR:  syntax error at or near "a"
LINE 1: DELETE a, b FROM wp_options a, wp_options b
               ^
---------------------

Since PostgreSQL does not support multi-table DELETE statements,
significant rewriting must be done.  Since I could not think of a good
generic way to perform this rewriting, recognize this statement
specifically and provide an alternative version.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
2015-06-03 00:42:27 -06:00
..
2014-08-21 16:53:30 +00:00