-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Also search for pg4wp
data files in the WordPress root directory
#13
Also search for pg4wp
data files in the WordPress root directory
#13
Conversation
Thanks for the PR! Could you explain why pg4wp would be bundled in the root directory rather than the The comment in your second commit suggests that There are some queries which would be mis-translated by your current approach (e.g. |
Basically for this: https://hub.docker.com/r/ntninja/wordpress-postgresql/
I have no idea what you are refering to with SELECT 'true' WHERE '' = ''; -- Returns 'true' vs SELECT 'true' WHERE '' IS NULL; -- Returns nothing in my PostgreSQL database browser. I don't have any MySQL server here to test, but the issue I tried to solve was definitely related to this. I'll extract a sample query for you.
I didn't know MySQL has multiline string syntax, will fix this!
Since these won't be corrupted either I don't see the issue here. |
Some script that is part of page theme of a page I'm maintaining queries the database for a list of all posts whose images should be displayed as part of a slider animation. qTranslate-X then hooks into all queries and ensures that only posts with a localized or no description will be retrieved: SELECT wp_posts.id
FROM wp_posts
WHERE 1 = 1
AND wp_posts.post_type = 'slide'
AND (( wp_posts.post_status = 'publish' ))
AND ( wp_posts.post_content = ''
OR wp_posts.post_content LIKE '%![:de!]%' escape '!'
OR wp_posts.post_content LIKE '%%'
OR ( wp_posts.post_content NOT LIKE '%![:!]%' escape '!'
AND wp_posts.post_content NOT LIKE '%%' ) )
ORDER BY wp_posts.post_date DESC
LIMIT 0, 5 All of the relevant database entries have no description in this case however:
Since in PostgreSQL |
Cool! Thanks for putting that together, it looks useful! I still don't understand the advantage of putting pg4wp in the Wordpress root directory. Couldn't you just change
I'm afraid I have mislead you here. It's not multi-line syntax but escaping of apostrophe. For example
If both Thanks for the example data and query, that's very helpful! From your description I created the following script: DROP TABLE IF EXISTS wp_posts;
CREATE TABLE wp_posts (
id INT PRIMARY KEY,
post_date TIMESTAMP NOT NULL,
post_content TEXT,
post_status VARCHAR(20) NOT NULL,
post_type VARCHAR(20) NOT NULL
);
INSERT INTO wp_posts (id, post_date, post_content, post_status, post_type)
VALUES (185, '2013-08-14 07:00:58', NULL, 'publish', 'slide'),
(178, '2013-08-14 08:00:26', NULL, 'publish', 'slide'),
(177, '2013-08-14 09:00:49', NULL, 'publish', 'slide');
SELECT wp_posts.id
FROM wp_posts
WHERE 1 = 1
AND wp_posts.post_type = 'slide'
AND (( wp_posts.post_status = 'publish' ))
AND ( wp_posts.post_content = ''
OR wp_posts.post_content LIKE '%![:de!]%' escape '!'
OR wp_posts.post_content LIKE '%%'
OR ( wp_posts.post_content NOT LIKE '%![:!]%' escape '!'
AND wp_posts.post_content NOT LIKE '%%' ) )
ORDER BY wp_posts.post_date DESC; This script produced the same result for me on MySQL and PostgreSQL (no rows). Changing |
Glad you see it this way. Other people respond quite differently at times…
Mostly because the
I don't have any MySQL server to test, but I just tried creating a new, empty post in WordPress and |
ident=''
)pg4wp
data files in the WordPress root directory
Thanks for explaining! That makes sense and sounds like a good plan and a good enough reason to support
No worries. That happens. If the NULL values reappear or you are able to figure out how the NULL comparison behavior differed, feel free to open another issue or PR and I'll help isolate and address it. Thanks again for the PR and for taking the time to work through all of my questions in detail. Much appreciated! |
Title says it all, see the first commit. Also search for the
pg4wp
data files in the WordPress root directory in order to better support installations where these are bundled along with WordPress.